public class PropertyPlaceholderResolver extends Object implements Serializable
{graphite.host}'
or '{graphite.port:2003}'.
If the placeholder is not found in the system properties, it is searched in the environment variables and then
converted to underscore delimited upper case and searched in environment variables.
Sample for '{graphite.port:2003}':
System.getProperty("graphite.port")System.getenv("graphite.port")System.getenv("GRAPHITE_PORT")2003| Constructor and Description |
|---|
PropertyPlaceholderResolver() |
| Modifier and Type | Method and Description |
|---|---|
protected String |
resolvePlaceholder(String property,
String defaultValue)
Search for the given placeholder in system properties then in environment variables.
|
String |
resolveString(String string)
Parse the given
string resolving property placeholders (${my-property[:default-value]}) |
public String resolveString(String string) throws IllegalStateException
string resolving property placeholders (${my-property[:default-value]})string - the string to parse.null.IllegalStateException - a property placeholder could not be resolved and no default value has been defined.protected String resolvePlaceholder(String property, String defaultValue) throws IllegalStateException
property - property to resolvedefaultValue - Default value if the placeholder is not found. null means not default value is
defined and the placeholder must existIllegalStateException - if the placeholder is not found and the given defaultValue is not
defined (null)Copyright © 2013. All Rights Reserved.