【问题标题】:GIN binding problems in GWTP applicationGWTP 应用程序中的 GIN 绑定问题
【发布时间】:2012-03-26 13:01:13
【问题描述】:

每个人! 我的 GWT 应用程序出现编译问题,该应用程序分为 3 个模块: App-core:包含没有入口点的主要类, App-A 和 App-B:继承自 App-core,并在每个子模块中包含带有入口点的特定类。

我正在使用 GIN 在每个模块中注入类实例:

在应用核心中:

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 的 maven 编译失败,并显示以下消息:

[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 的绑定,但我们只有一个子模块有这个编译错误。 所以如果有人遇到这个问题之王,我正在等待他的宝贵帮助^^

啊!如果你想要一些精度,不要害羞!

【问题讨论】:

  • 几个问题(如果没有要查看的所有代码,这很困难,GWTP 有很多文件可以将其分解成),您要为 EventBus 导入什么,它是 com .google.gwt.event.shared.EventBus?此外,您的 PlaceManager 实现应该是 PlaceManagerImpl 的子类。如果您可以捆绑代码,我应该能够为您解决这个问题,有很多可能出错的地方,而且要知道从哪里开始查找这里的内容并不容易。我处理这个的方法是简化,首先删除除 EventBus 和 PlaceManager 之外的所有内容,看看是否可以得到

标签: gwt gwt-gin


【解决方案1】:

在 GWTP 0.7 和所有 EventBus 实例都从

    com.google.gwt.event.shared.EventBus;
    to 
    com.google.web.bindery.event.shared.EventBus

如果您使用的是 GWTP 0.6,则必须将它们改回来...

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-06-10
    • 1970-01-01
    • 2019-09-20
    • 1970-01-01
    • 1970-01-01
    • 2018-12-07
    • 1970-01-01
    相关资源
    最近更新 更多