Module io.inverno.mod.configuration
Class BootstrapConfigurationSource
java.lang.Object
io.inverno.mod.configuration.source.CompositeConfigurationSource
io.inverno.mod.configuration.source.BootstrapConfigurationSource
- All Implemented Interfaces:
ConfigurationSource<CompositeConfigurationSource.CompositeConfigurationQuery,
CompositeConfigurationSource.CompositeExecutableConfigurationQuery, CompositeConfigurationSource.CompositeListConfigurationQuery>
A configuration source that considers multiple local sources to load the bootstrap configuration of an application.
It resolves configuration properties from the following sources in that order:
- command line arguments
- system properties
- system environment variables
- the
configuration.cprops
file in./conf/
or${inverno.config.path}/
directories if one exists (if the first one exists the second one is ignored) - the
configuration.cprops
file in${java.home}/conf/
directory if it exists - the
configuration.cprops
file in the application module if it exists
This source is typically created in a main
method to load the application configuration at startup.
public class Application {
public static void main(String[] args) {
BootstrapConfigurationSource source = new BootstrapConfigurationSource(App.class.getModule(), args);
// Load configuration
ApplicationConfiguration configuration = ConfigurationLoader
.withConfiguration(ApplicationConfiguration.class)
.withSource(source)
.load()
.block();
// Start the application with the configuration
...
}
}
- Since:
- 1.0
- Author:
- Jeremy Kuhn
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class io.inverno.mod.configuration.source.CompositeConfigurationSource
CompositeConfigurationSource.CompositeConfigurationQuery, CompositeConfigurationSource.CompositeConfigurationQueryResult, CompositeConfigurationSource.CompositeExecutableConfigurationQuery, CompositeConfigurationSource.CompositeListConfigurationQuery
-
Constructor Summary
ConstructorDescriptionBootstrapConfigurationSource
(Module module, String... args) Creates a bootstrap configuration source for the specified application module and with the specified command line arguments. -
Method Summary
Methods inherited from class io.inverno.mod.configuration.source.CompositeConfigurationSource
get, getSources, getStrategy, list, setStrategy
-
Constructor Details
-
BootstrapConfigurationSource
Creates a bootstrap configuration source for the specified application module and with the specified command line arguments.
- Parameters:
module
- the application moduleargs
- the command line arguments- Throws:
IOException
- if something goes wrong creating the configuration source
-