This is how my solution look.
The RequestFactory
public interface DiveRequestFactory extends RequestFactory { @Service(com.smithimage.idive.server.Communication.DiveService.class) public interface DiveRequest extends RequestContext { Request<DiveProxy> findDive(String id); InstanceRequest<DiveProxy, Void> persist(); InstanceRequest6lt;DiveProxy, Void> remove(); } DiveRequest getDiveRequest(); }
The GIN module
public class DiveServiceModule extends AbstractGinModule{ @Override protected void configure() { bind(EventBus.class).to(SimpleEventBus.class).in(Singleton.class); bind(MainPresenter.class).in(Singleton.class); bind(LogonPresenter.class).in(Singleton.class); ... requestStaticInjection(); } @Provides @Singleton IdiveRequestFactory providesDiveRequestFactory(EventBus eventBus){ IdiveRequestFactory idiveRequestFactory = GWT.create(IdiveRequestFactory.class); idiveRequestFactory.initialize(eventBus); return idiveRequestFactory; } }
The consuming class
@Inject public DiveListPresenter(Display display, MenuDisplay menuDisplay, MainPresenter.Display mainDisplay, EventBus eventbus, DiveDAO diveDAO, UserDAO userDAO, LocationService locationService, DiveRequestFactory diveRequestFactory){ ... }