Guice Module for setting up archaius and making its components injectable. Installing this
module also enables the following functionality.
- Injectable Config
- Configuration Proxy
- Configuration mapping
Note that this module has state and should therefore only be installed once. It should only
be installed by applications and not by libraries depending on archaius. Such libraries
should only specify a bindger.requiresBinding(Config.class).
This module creates an injectable Config instances that has the following override structure in
order of precedence.
RUNTIME - properties set from code
REMOTE - properties loaded from a remote source
SYSTEM - System properties
ENVIRONMENT - Environment properties
APPLICATION - Configuration loaded by the application
LIBRARIES - Configuration loaded by libraries used by the application
Runtime properties may be set in code by injecting and calling one of the setXXX methods of,
@RuntimeLayer SettableConfig config
A remote configuration may be specified by binding to @RemoteLayer Config
When setting up a remote configuration that needs access to Archaius's Config
make sure to inject the qualified @Raw Config otherwise the injector will fail
with a circular dependency error. Note that the injected config will have
system, environment and application properties loaded into it.
public class FooRemoteModule extends AbstractModule {
@Override
protected void configure() {}
@Provides
@RemoteLayer
Config getRemoteConfig(@Raw Config config) {
return new FooRemoteConfigImplementaiton(config);
}
}