实例化具有多个AbstractModule的注入器

时间:2009-10-13 08:17:38

标签: gwt guice gin

在google Guice中,我可以使用函数createInjector创建基于多个模块的注入器。

因为我使用GWT.create来设置GoogleGin中的注入器,是否可以基于多个AbstractGinModule创建一个Ginjector。

如果我们不能,您如何组织代码以避免在同一个模块中拥有所有绑定?

1 个答案:

答案 0 :(得分:7)

我使用以下代码创建使用多个模块的注入器:

@GinModules({ ClientDispatchModule.class, MyClientModule.class })
public interface MyAppGinjector extends Ginjector {

    AppPresenter getAppPresenter();

    PlaceManager getPlaceManager();

    EventBus getEventBus();
}