public class ConfigurationManager extends Object
exam.properties at the root of the
classpath. System properties take precedence over properties in the configuration file.
Also allows setting system properties from a properties URL.
| Constructor and Description |
|---|
ConfigurationManager()
Creates a configuration manager.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getProperty(String key)
Returns the configuration property for the given key.
|
String |
getProperty(String key,
String defaultValue)
Returns the configuration property for the given key, or the given default value.
|
void |
loadSystemProperties(String configurationKey)
Loads system properties from the given configuration key.
|
public ConfigurationManager()
public String getProperty(String key)
key - configuration keypublic String getProperty(String key, String defaultValue)
key - configuration keydefaultValue - default value for keypublic void loadSystemProperties(String configurationKey)
If this configuration key has no value, then this method has no effect.
If the value starts with env:, this prefix is stripped and the remainder is taken to
be an environment variable. The value is then replaced by the value of the environment
variable.
This value is now interpreted as a classpath resource and converted to a URL. If the value has no matching classpath resource, the value itself is interpreted as a URL.
Finally, properties are loaded from this URL and merged into the current system properties.
configurationKey - configuration key, the value defining a property sourceCopyright © 2006–2017 OPS4J - Open Participation Software for Java. All rights reserved.