I have a Module
that provides a JDBI DBI
instance like this:
@Provides
@Singleton
DBI dbi(DataSource dataSource) { return new DBI(dataS
The Guice Injections documentation describes how to invoke an instance method by annotating the method with @Inject.
It doesn't mention that the instance can be a Guice module. As such, you can do this:
class MyConfigurationModule extends AbstractModule {
@Override
protected void configure() {
requestInjection(this);
}
@Inject
void configureDbi(DBI dbi) {
// Do whatever configuration.
}
}