2011-10-30 10 views
5

GINモジュール:GWTのGIN - 些細なユースケースが失敗した(EventBus)

public class InjectorModule extends AbstractGinModule { 
    @Override 
    protected void configure() { 
     bind(EventBus.class).to(SimpleEventBus.class).in(Singleton.class); 
    } 
} 

インジェクター:

@GinModules(InjectorModule.class) 
public interface Injector extends Ginjector { 
    EventBus getEventBus(); 
} 

GWTモジュールのエントリポイント:

injector.getEventBus()メイクへの呼び出しを削除する
public class Module1 implements EntryPoint { 
    private final Injector injector = GWT.create(Injector.class); 

    public void onModuleLoad() {   
     injector.getEventBus(); 
    } 
} 

すべて正常に動作します。 injector.getEventBus()原因に呼び出し:

Caused by: java.lang.RuntimeException: Deferred binding failed for 'com.google.web.bindery.event.shared.EventBus' (did you forget to inherit a required module?) 
at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:53) 
at com.google.gwt.core.client.GWT.create(GWT.java:97) 
at com.XXX.app.client.InjectorImpl.create_Key$type$com$google$web$bindery$event$shared$EventBus$_annotation$$none$$(InjectorImpl.java:72) 
at com.XXX.app.client.InjectorImpl.get_Key$type$com$google$web$bindery$event$shared$EventBus$_annotation$$none$$(InjectorImpl.java:86) 
at com.XXX.app.client.InjectorImpl.getEventBus(InjectorImpl.java:7) 
at com.XXX.app.client.Module1.onModuleLoad(Module1.java:24) 

GWT開発モードは言う:

23:58:50.287 [ERROR] Deferred binding result type 'com.google.web.bindery.event.shared.EventBus' should not be abstract 

答えて

7

あなたはGWT 2.4を使用している場合:

2 EventBusは、(1が推奨されません)を使用していることを確認し、今がありますあなたの入口にも同じタイプがあります。

関連する問題