<dependency> <groupId>com.google.gwt.inject</groupId> <artifactId>gin</artifactId> <version>2.1.2</version> </dependency> <dependency> <groupId>com.example</groupId> <artifactId>your-java-library</artifactId> <version>1.0.0</version> </dependency> import com.google.gwt.inject.client.AbstractGinModule; import com.example.yourjavaclasses.YourJavaInterface; import com.example.yourjavaclasses.YourJavaImplementation; public class YourAppGinModule extends AbstractGinModule { @Override protected void configure() { bind(YourJavaInterface.class).to(YourJavaImplementation.class); } } <inherits name="com.google.gwt.inject.Inject"/> import com.google.gwt.inject.client.GinModules; import com.google.gwt.inject.client.Ginjector; import com.google.gwt.inject.client.Injector; @GinModules(YourAppGinModule.class) public interface YourAppGinjector extends Ginjector { YourPresenter getYourPresenter(); } public class YourPresenter { private final YourJavaInterface yourJavaInterface; @Inject public YourPresenter(YourJavaInterface yourJavaInterface) { this.yourJavaInterface = yourJavaInterface; } }


上一篇:
下一篇:
切换中文