Yes, you can use Gin to enter the submit interface using the @Inject annotation.
First you need to configure the Gin binding for the DispatchAsync interface to implement in your Gin ClientModule.
bind(DispatchAsync.class).to(DefaultDispatchAsync.class).in(Singleton.class);
Once this is done, you can force Gin to inject a dispatcher into your constructors.
class foo {
private final DispatchAsync dispatcher;
@Inject
public foo(final DispatchAsync dispacher) {
this.dispatcher = dispatcher;
}
}
source
share