开发者

Gin weird behavior in a Gwt project

For some inexplicable reason for me ,Gin does not works as i intend. Let me explain with little code.

Let say i have a formA

@Singleton
public class formA extends Composite

    private final MyGinjector ginjector;

    @Inject
    public formA(MyGinjector ginjector)
    {
      this.ginjector = ginjector;
      this.add(ginjector.getFormB());
      this.add(ginjector.getFormC());   
    }

here are and formB and formC (let assume formB and formC has similar code)

@Singleton
public class formB extends Composite
{
@Inject
public formB(MyGinjector ginjector)
{
  this.ginjector = ginjector;
..............
}
}

And the problem i has been facing is in some moment when i inject formA (ginjector.getFormA() return an instance of formA but with missing childWidgets meaning with no reference to开发者_如何学编程 formB and formC

What could be the problem? all forms are singleton ... probably i should not inject the ginjector like that?

Thanks


I believe gin does not support injecting the injector: gin groups discussion.

Is there any reason you try injecting injector instead od injecting dependencies directly?

You should just inject dependencies directly:

    @Inject
    public formA(FormB formB, FormC formC){
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜