Reading externalized primitive configurations in Guice apps.
Load configs:
// Java Preferences
Module conf = PrefesModule.system("/path/to/prefs");
// JNDI
Module conf = new JndiModule();
// Properties (file)
Module conf = new PropsModule(properties);
Install them:
protected void configure() {
install(conf);
...
}
Or push them:
Modules.override(mainModule).with(config);
Then use them:
@Inject @Named("foo")
private String foo;
<dependency>
<groupId>me.shakiba.guice-config</groupId>
<artifactId>guice-config</artifactId>
<version>0.0.4</version>
</dependency>