https://bitbucket.org/strangerintheq/guice-config

Usage example:

At first we have a properties file 'config.properties':

test.key=test value

And we want to inject this value like this:

@Inject@Config( Property.TEST_KEY )private String injectedValue;

We need to load contents of file 'config.properties' into 
java.util.Properties and pass it to Config module:

Properties props = new Properties();props.load(...);Module configModule = new 
ConfigModule( props, Property.values() );

... and injecting:

Injector injector = Guice.createInjector( configModule );TestClass testClass = 
injector.getInstance( TestClass.class );String injectedValue = 
testClass.getInjectedValue();

injected value will be 'test value'...

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-guice+unsubscr...@googlegroups.com.
To post to this group, send email to google-guice@googlegroups.com.
Visit this group at http://groups.google.com/group/google-guice.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-guice/28f51f39-e29a-4f9c-a9ea-c70749adb8f6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to