MVP GWT-注入事件总线时出现问题

MVP GWT-注入事件总线时出现问题,gwt,dependency-injection,mvp,Gwt,Dependency Injection,Mvp,奇怪的问题,当我注入EventBus e时,出现了一个异常。该项目是使用mvp的gwt 下面是示例代码 杜松子酒 这里是入口点 public class MvpEntryPoint implements EntryPoint { AppGinjector ginjector = GWT.create(AppGinjector.class); public void onModuleLoad() { EventBus eventBus = ginjector.geEventBus();

奇怪的问题,当我注入EventBus e时,出现了一个异常。该项目是使用mvp的gwt

下面是示例代码

杜松子酒

这里是入口点

public class MvpEntryPoint implements EntryPoint
{
AppGinjector ginjector = GWT.create(AppGinjector.class);

public void onModuleLoad()
{

  EventBus eventBus = ginjector.geEventBus();
  HelloWorldPanel display = new HelloWorldPanel();
  HelloWorldPresenter presenter = new HelloWorldPresenter( display, eventBus );

  presenter.bind();

  RootPanel.get().add( presenter.getDisplay().asWidget() );

  PlaceManager placeManager =  ginjector.getPlaceManager();
  placeManager.fireCurrentPlace();

}
我使用gin 1.0,gwt presenter

有人知道吗

谢谢

编辑:

例外是

ERROR: Deferred binding result type 'net.customware.gwt.presenter.client.EventBus' should not be abstract. 
ERROR: Unable to load module entry point class com.gmgsys.mvpEntryPoint.client.MvpEntryPoint (see associated exception for details). java.lang.RuntimeException: Deferred binding failed for 'net.customware.gwt.presenter.client.EventBus' (did you forget to inherit a required module?)
...........................
还有gwt.xml

  <!-- Specify the app entry point class.                   -->
    <entry-point class='com.gmgsys.mvpEntryPoint.client.MvpEntryPoint'/>
    <inherits name='net.customware.gwt.presenter.Presenter' />
    <inherits name="com.google.gwt.inject.Inject" />

我认为您缺少确保EventBus绑定到SimpleEventBus的AbstractPresenterModule类:

bind(EventBus.class).to(SimpleEventBus.class).in(Singleton.class);
应该是这样的:

public class MyClientModule extends AbstractPresenterModule {
  protected void configure() {
     bind(EventBus.class).to(SimpleEventBus.class).in(Singleton.class);
     // more bindings here
  }
}
你必须给你的Ginjector加上注解

@GinModules({ MyClientModule .class })
public interface AppGinjector extends Ginjector
{
  EventBus getEventBus();
  PlaceManager getPlaceManager();
}
@GinModules({ MyClientModule .class })
public interface AppGinjector extends Ginjector
{
  EventBus getEventBus();
  PlaceManager getPlaceManager();
}