2009-10-13 101 views
2

在谷歌吉斯的噴射器,我能夠基於與所述功能createInjector多個模塊上創建的噴射器。實例化與多個AbstractGinModule

因爲我使用GWT.create來實現GoogleGin中的注入器的實例,是否可以基於多個AbstractGinModule創建注入器。

如果我們不能,你如何組織你的代碼,以避免在同一模塊所有的約束力?

回答

7

我用下面的代碼來創建它使用多個模塊噴油器:

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

    AppPresenter getAppPresenter(); 

    PlaceManager getPlaceManager(); 

    EventBus getEventBus(); 
} 
+0

完美:)。謝謝 – 2009-10-14 05:40:37