Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/gwt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Gin AssistedInject:延迟绑定结果类型“Foo”不应是抽象的_Java_Gwt_Dependency Injection_Gwt Gin_Assisted Inject - Fatal编程技术网

Java Gin AssistedInject:延迟绑定结果类型“Foo”不应是抽象的

Java Gin AssistedInject:延迟绑定结果类型“Foo”不应是抽象的,java,gwt,dependency-injection,gwt-gin,assisted-inject,Java,Gwt,Dependency Injection,Gwt Gin,Assisted Inject,我正在尝试在GWT 2.4.0中使用带有杜松子酒的AssistedInject: public interface ElevatorButtonFactory { ElevatorButton create(int shownFloorNumber, Action<Integer> onClick); } @Inject ElevatorButton(GameHost gameHost, @Assisted int shownFloorNumber,

我正在尝试在GWT 2.4.0中使用带有杜松子酒的AssistedInject:

  public interface ElevatorButtonFactory {
    ElevatorButton create(int shownFloorNumber, Action<Integer> onClick);
  }

  @Inject
  ElevatorButton(GameHost gameHost, @Assisted int shownFloorNumber,
      @Assisted Action<Integer> onClick) {
    // ...
  }
这似乎足够了,对吧?但当我尝试将ElevatorButtonFactory作为一个注入参数时,我得到以下错误:

[错误][foo]-延迟绑定结果类型 'com.foo.html.client.components.floorpicker.ElevatorButton.ElevatorButtonFactory' 不应该是抽象的


我做错了什么?

看来问题不在于杜松子酒。这是关于你如何使用你的ElevatorButtonFactory课程。喷油器接口应如下所示:

@GinModules(YourGinModule.class)
public interface InjectorService extends Ginjector {

    ElevatorButtonFactory getElevatorButtonFactory();

}
创建升降按钮实例:

GWT.create(InjectorService.class).getElevatorButtonFactory().create(...)
您可能试图通过GWT.create或其他方式实例化工厂?如果问题不会消失,让我看看完整的stacktrace

GWT.create(InjectorService.class).getElevatorButtonFactory().create(...)