public interface ConfigSource
Implement this interfaces to provide a ConfigSource. A ConfigSource provides configuration values from a specific place, like JNDI configuration, a properties file, etc. A ConfigSource is always read-only, any potential updates of the configured values must be handled directly inside each ConfigSource.
The default config sources always available by default are:
Custom ConfigSource will get picked up via the ServiceLoader mechanism and and can be registered by
providing a file
META-INF/services/org.eclipse.microprofile.config.spi.ConfigSource
which contains the fully qualified ConfigSource implementation class name as content.
Adding a dynamic amount of custom config sources can be done programmatically via
ConfigSourceProvider.
| Modifier and Type | Field and Description |
|---|---|
static String |
CONFIG_ORDINAL |
| Modifier and Type | Method and Description |
|---|---|
String |
getName()
The name of the config might be used for logging or analysis of configured values.
|
int |
getOrdinal()
Return the ordinal for this config source.
|
Map<String,String> |
getProperties()
Return the properties in this config source
|
String |
getValue(String propertyName)
Return the value for the specified property in this config source.
|
static final String CONFIG_ORDINAL
Map<String,String> getProperties()
String getValue(String propertyName)
propertyName - the property nameString getName()
int getOrdinal()
The default ordinals for the default config sources:
Any ConfigSource part of an application will typically use an ordinal between 0 and 200. ConfigSource provided by the container or 'environment' typically use an ordinal higher than 200. A framework which intends have values overwritten by the application will use ordinals between 0 and 100. The property "config_ordinal" can be specified to override the default value.
Copyright © 2017. All rights reserved.