我正在使用GIN在每个模块中注入类实例:
在App-core中:
public interface App-coreGinjector extends Ginjector {
EventBus getEventBus();
Provider<LoginPagePresenter> getLoginPagePresenter();
...
}
App-coreModule extends AbstractPresenterModule {
protected void configureCore() {
install(new DefaultModule(App-corePlaceManager.class));
bindConstant().annotatedWith(DefaultPlace.class).to(LoginPagePresenter.NAME_TOKEN);
...
bind(AuthenticationManager.class).to(AuthenticationManagerImpl.class);
bindPresenter(LoginPagePresenter.class, LoginPagePresenter.MyView.class,
LoginPageView.class, LoginPagePresenter.MyProxy.class);
}
App-A中的:
@GinModules({ App-AModule.class })
public interface App-AGinjector extends App-coreGinjector {
MyApp-AScreen getMyApp-AScreen();
...
}
public class App-AModule extends App-coreModule {
@Override
protected void configure() {
configureCore();
...
//Here we bind the App-A classes inheriting from App-core classes
bind(App-coreScreenManager.class).to(App-AcreenManager.class).in(Singleton.class);
...
//Here we bind the specific App=A classes
}
我们在App-B中做同样的事情
App-A的maven编译成功,但App-B失败,显示以下消息:
[ERROR] Errors in 'C:\workspace\App-core\client\gin\App-coreGinjectorImpl.java'
[ERROR] Line 790: Rebind result 'com.gwtplatform.mvp.client.proxy.PlaceManager' must be a class
[ERROR] Line 818: Rebind result 'lu.sfeir.grh.client.authentication.AuthenticationManager' must be a class
[ERROR] Line 1047: Rebind result 'lu.sfeir.grh.client.login.LoginPagePresenter.MyView' must be a class
[ERROR] Line 2359: Rebind result 'com.google.gwt.event.shared.EventBus' cannot be abstract
[ERROR] Cannot proceed due to previous errors
所以这个奇怪的部分是这个错误来自这两个子模块之间的共享模块,这是LoginPagePresenter和AuthentificationManager的绑定,但我们只在一个子模块中有这个编译错误。 所以,如果有人有这个问题之王,我正在等待他的宝贵帮助^^
啊!如果你想要一些精确,不要害羞!
答案 0 :(得分:2)
在GWTP 0.7中,所有EventBus实例都从
更改 com.google.gwt.event.shared.EventBus;
to
com.google.web.bindery.event.shared.EventBus
如果您使用的是GWTP 0.6,则需要将其更改回来......