类 SystemPropertyUtils
- java.lang.Object
- org.springframework.util.SystemPropertyUtils
public abstract class SystemPropertyUtils extends Object
Helper class for resolving placeholders in texts. Usually applied to file paths.A text may contain
${...}
placeholders, to be resolved as system properties: e.g.${user.dir}
. Default values can be supplied using the ":" separator between key and value.- 从以下版本开始:
- 1.2.5
- 作者:
- Juergen Hoeller, Rob Harrop, Dave Syer
- 另请参阅:
PLACEHOLDER_PREFIX
,PLACEHOLDER_SUFFIX
,System.getProperty(String)
字段概要
字段 修饰符和类型 字段 说明 static String
PLACEHOLDER_PREFIX
Prefix for system property placeholders: "${"static String
PLACEHOLDER_SUFFIX
Suffix for system property placeholders: "}"static String
VALUE_SEPARATOR
Value separator for system property placeholders: ":"
构造器概要
构造器 构造器 说明 SystemPropertyUtils()
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static String
resolvePlaceholders(String text)
Resolve${...}
placeholders in the given text, replacing them with corresponding system property values.static String
resolvePlaceholders(String text, boolean ignoreUnresolvablePlaceholders)
Resolve${...}
placeholders in the given text, replacing them with corresponding system property values.
字段详细资料
PLACEHOLDER_PREFIX
public static final String PLACEHOLDER_PREFIX
Prefix for system property placeholders: "${"- 另请参阅:
- 常量字段值
PLACEHOLDER_SUFFIX
public static final String PLACEHOLDER_SUFFIX
Suffix for system property placeholders: "}"- 另请参阅:
- 常量字段值
VALUE_SEPARATOR
public static final String VALUE_SEPARATOR
Value separator for system property placeholders: ":"- 另请参阅:
- 常量字段值
构造器详细资料
SystemPropertyUtils
public SystemPropertyUtils()
方法详细资料
resolvePlaceholders
public static String resolvePlaceholders(String text)
Resolve${...}
placeholders in the given text, replacing them with corresponding system property values.- 参数:
text
- the String to resolve- 返回:
- the resolved String
- 抛出:
IllegalArgumentException
- if there is an unresolvable placeholder- 另请参阅:
PLACEHOLDER_PREFIX
,PLACEHOLDER_SUFFIX
resolvePlaceholders
public static String resolvePlaceholders(String text, boolean ignoreUnresolvablePlaceholders)
Resolve${...}
placeholders in the given text, replacing them with corresponding system property values. Unresolvable placeholders with no default value are ignored and passed through unchanged if the flag is set totrue
.- 参数:
text
- the String to resolveignoreUnresolvablePlaceholders
- whether unresolved placeholders are to be ignored- 返回:
- the resolved String
- 抛出:
IllegalArgumentException
- if there is an unresolvable placeholder and the "ignoreUnresolvablePlaceholders" flag isfalse
- 另请参阅:
PLACEHOLDER_PREFIX
,PLACEHOLDER_SUFFIX