我正在尝试在 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 活动中注入事件总线时,问题就来了:
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 会抱怨,因为我没有为它指定绑定。
更新:这将允许应用程序构建,但现在有两个不同EventBus
的 s,这很糟糕:
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);
...