Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5985397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:31:27+00:00 2026-05-22T22:31:27+00:00

here is my problem. I m using Gin in a gwt project, i m

  • 0

here is my problem. I m using Gin in a gwt project, i m using GWT.create(SomeClass.class) to get instance ,but the problem is that i want signleton instance and for that purpose i bind that class in the app module to be singleton. Every tome i execute GWT.create(TemplatePanel.class) it returns different instance..why??
Here is snippet of my code.
Module

public class AppClientModule extends AbstractGinModule
{
protected void configure()
{
  bind(MainPanel.class).in(Singleton.class);
  bind(TemplatePanel.class).in(Singleton.class);
}
} 

Injector

@GinModules(AppClientModule.class)
public interface AppInjector extends Ginjector
{
  MainPanel getMainForm();
  TemplatePanel getTemplateForm();
}

TemplatePanel

public class TemplatePanel extends VerticalPanel
@Inject
public TemplatePanel()
{
  this.add(initHeader());
  this.add(initContent());
}
..

MainPanel

public void onSuccess(List<MyUser> result)
    {
.......
  TemplatePanel temp = GWT.create(TemplatePanel.class);

.......
}

And the entry point

private final AppInjector injector = GWT.create(AppInjector.class);
public void onModuleLoad()
{
  MainPanel mf = injector.getMainForm();
  TemplatePanel template = injector.getTemplateForm();
  template.setContent(mf);
  RootPanel.get().add(template);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T22:31:28+00:00Added an answer on May 22, 2026 at 10:31 pm

    GWT.create(..) does not work with GIN, it just creates an object in a normal GWT way. You should either:

    1. Inject TemplatePanel in MainPanel, or

    2. Instantiate injector (via static method maybe) and then get TemplatePanel.

    I usually have a static reference to injector (since you only need one per app) so I can access it anywhere:

    @GinModules(AppClientModule.class)
    public interface AppInjector extends Ginjector
    {
        AppInjector INSTANCE = GWT.create(AppInjector.class);
    
        MainPanel getMainForm();
        TemplatePanel getTemplateForm();
    }
    

    (Note: constant interface fields are by definition public and static, so you can omit those.)

    Then you’d use:

    TemplatePanel temp = AppInjector.INSTANCE.getTemplateForm();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem using Gin. Here is a simple example. @GinModules(AppModule.class) public interface
I've got a problem here with an MSI deployment that I'm working on (using
So here is my problem. I want to redirect name.domain.com/trips/1 to domain.com?username=name&trip=1 using modrewrite.
Here's the core problem: I have a .NET application that is using COM interop
Now I create a small PHP Application, here I have problem for using file
I have a problem using a class of made of structures. Here's the basic
Here's the problem. I would like to create a class which will contain configuration
This is fairly 'math-y' but I'm posting here because it's a Project Euler problem,
I have a problem here using .dbf files. I can make CRUD operations but
I have a problem using JSON and arrays. Here is my code: while($row =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.