开发者

GWT Generator not called with GIN Injection

I have declared a generator in my GWT module descriptor and it seems it is not called when the class which trigger the generator is instanciated via the Ginjector.

publi开发者_Go百科c interface MyGinjector extends Ginjector {
  MyWidget getMyWidget();
}


public class MyEntryPoint implements EntryPoint {

  public static final MyGinjector INJECTOR = GWT.create(MyGinjector.class);

  public void onModuleLoad() {
    MyWidget myWidget = INJECTOR.getMyWidget(); // [1]
    MyWidget myWidget = GWT.create(MyWidget.class); // [2]
    RootPanel.add(myWidget);
  }

}

[1] The generator is not called.

[2] The generator is called.

Does it mean that the GIN injector does not instanciate object through the GWT.create() method?

Thanks for your help. Kind regards,


AFAIK, GIN (at least up until 1.5) will only generate a GWT.create() if the class has a public zero-arg constructor that is not annotated with @Inject (otherwise it'll do a new on it)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜