我正在尝试在 MVP GWT 2.4 中使用 Gin。在我的模块中,我有:
import com.google.web.bindery.event.shared.EventBus;
import com.google.web.bindery.event.shared.SimpleEventBus;
@Override
protected void configure() {
bind(EventBus.class).to(SimpleEventBus.class).in(Singleton.class);
...
}
以上代码使用了新的 com.google.web.bindery.event.shared.EventBus
。当我想在实现 Activity 的 MVP Activity 中注入(inject)事件总线时,问题就来了:
package com.google.gwt.activity.shared;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
public interface Activity {
...
void start(AcceptsOneWidget panel, EventBus eventBus);
}
Activity
使用已弃用的 com.google.gwt.event.shared.EventBus
。我怎样才能调和这两者?显然,如果我请求已弃用的 EventBus 类型,那么 Gin 会提示,因为我没有为它指定绑定(bind)。
更新:这将允许应用构建,但现在有两个不同的 EventBus
,这很糟糕:
protected void configure() {
bind(com.google.gwt.event.shared.EventBus.class).to(
com.google.gwt.event.shared.SimpleEventBus.class).in(Singleton.class);
bind(EventBus.class).to(SimpleEventBus.class).in(Singleton.class);
...
最佳答案
为此记录了一个当前问题:http://code.google.com/p/google-web-toolkit/issues/detail?id=6653
不幸的是,建议的解决方法是暂时在您的代码中坚持使用已弃用的 EventBus
。
关于java - Gwt 2.4 中 EventBus 和 Gin 的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9267403/