public class PropertyPlaceholderResolver
extends java.lang.Object
implements java.io.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() |
PropertyPlaceholderResolver(java.util.Map<java.lang.String,java.lang.String> externalProperties) |
| Modifier and Type | Method and Description |
|---|---|
protected java.lang.String |
resolvePlaceholder(java.lang.String property,
java.lang.String defaultValue)
Search for the given placeholder in system properties then in environment variables.
|
java.lang.String |
resolveString(java.lang.String string)
Parse the given
string resolving property placeholders (${my-property[:default-value]}) |
public PropertyPlaceholderResolver(java.util.Map<java.lang.String,java.lang.String> externalProperties)
public PropertyPlaceholderResolver()
public java.lang.String resolveString(java.lang.String string)
throws java.lang.IllegalStateException
string resolving property placeholders (${my-property[:default-value]})string - the string to parse.null.java.lang.IllegalStateException - a property placeholder could not be resolved and no default value has been defined.protected java.lang.String resolvePlaceholder(java.lang.String property,
java.lang.String defaultValue)
throws java.lang.IllegalStateException
property - property to resolvedefaultValue - Default value if the placeholder is not found. null means not default value is
defined and the placeholder must existjava.lang.IllegalStateException - if the placeholder is not found and the given defaultValue is not
defined (null)Copyright © 2018. All Rights Reserved.