Module io.avaje.config
Package io.avaje.config
package io.avaje.config
Application configuration based on loading properties and yaml files.
Examples
int port = Config.getInt("app.port", 8090);
String topicName = Config.get("app.topic.name");
List<Integer> codes = Config.getList().ofInt("my.codes", 42, 54);
Loading into System properties
If config.load.systemProperties
is set to true
then all the properties are loaded into System properties.
File watching and reloading
We can enable watching configuration files by setting
config.watch.enabled=true
. With this enabled
config will watch for modifications to the configuration files
and reload the configuration.
By default the files are checked every 60 seconds. We can
change this by setting the config.watch.period
(which is in seconds). For example setting
config.watch.period=10
means the files are
checked every every 10 seconds.
By default there is an initial delay of 60 seconds. We can
change this by setting config.watch.delay
.
This can provide us a simple "feature toggle" mechanism.
// we can toggle this on/off by editing the
// appropriate property in the configuration file
if (Config.enabled("feature.cleanup", false)) {
...
}
-
ClassDescriptionProvides application Configuration based on loading properties and yaml files as well as plugins that supply properties (like dynamic configuration loaded from a db).Load a config file into a flattened map.Configuration API for accessing property values and registering onChange listeners.Build Configuration manually explicitly loading all the configuration as key value pairs.Expression evaluation.Return a List of values for a configuration key.Return a Set of values configured.Configuration events are sent to this event log.Additional source to load and update configuration.The event that occurs on configuration changes.Build and publish modifications to the configuration.Run the event listener notifications.Plugin API for loading resources typically from the classpath or module path.