Typesafe Config Guice

Allows Guice to @Inject configuration values into your application derived from Typesafe Config.

Build Status

Available on Maven: https://oss.sonatype.org/content/repositories/releases/.

<dependency>
    <groupId>com.github.racc</groupId>
    <artifactId>typesafeconfig-guice</artifactId>
    <version>0.0.1</version>
</dependency>

Quickstart

Step 1:

Annotate configuration injection points (Constructors, Providers, Provider methods, Setter methods, Fields) with @TypesafeConfig("config.path.key")

Step 2:

Bootstrap your application with Guice and the TypesafeConfigModule. Configuration values annotated with @TypesafeConfig will be scanned for on the classpath, and then bound from your supplied Typesafe Config file.

Config config = ConfigFactory.load("config.conf");
Injector injector = Guice.createInjector(
    TypesafeConfigModule.fromConfig(testConf)
    // ... Add your other modules here
);

Step 3:

Profit!

Features

AUTHOR

Jason Then (mailto:then.jason@gmail.com)

Any comments and feedback appreciated!

LICENSE

Copyright 2015 Jason Then

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.