Overview | Package | Class | Tree | Deprecated | Index | Help
| Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.springframework.util
Class SystemPropertyUtils

    java.lang.Object
      org.springframework.util.SystemPropertyUtils

    public abstract class SystemPropertyUtils

extends java.lang.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.

Since:
  1.2.5
Author:
  Juergen Hoeller, Rob Harrop, Dave Syer
See Also:
  `PLACEHOLDER_PREFIX`, `PLACEHOLDER_SUFFIX`, `System.getProperty(String)`

Field Summary
`static java.lang.String` | `PLACEHOLDER_PREFIX` Prefix for system property placeholders: "${"
`static java.lang.String` | `PLACEHOLDER_SUFFIX` Suffix for system property placeholders: "}"
`static java.lang.String` | `VALUE_SEPARATOR` Value separator for system property placeholders: ":"

Constructor Summary
`SystemPropertyUtils()`

Method Summary
`static java.lang.String` | `resolvePlaceholders(java.lang.String text)` Resolve ${...} placeholders in the given text, replacing them with corresponding system property values.
`static java.lang.String` | `resolvePlaceholders(java.lang.String text, boolean ignoreUnresolvablePlaceholders)` Resolve ${...} placeholders in the given text, replacing them with corresponding system property values.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### PLACEHOLDER_PREFIX

    public static final java.lang.String PLACEHOLDER_PREFIX

  Prefix for system property placeholders: "${"

  See Also:
    Constant Field Values

### PLACEHOLDER_SUFFIX

    public static final java.lang.String PLACEHOLDER_SUFFIX

  Suffix for system property placeholders: "}"

  See Also:
    Constant Field Values

### VALUE_SEPARATOR

    public static final java.lang.String VALUE_SEPARATOR

  Value separator for system property placeholders: ":"

  See Also:
    Constant Field Values

Constructor Detail

### SystemPropertyUtils

    public SystemPropertyUtils()

Method Detail

### resolvePlaceholders

    public static java.lang.String resolvePlaceholders(java.lang.String text)

  Resolve ${...} placeholders in the given text, replacing them with corresponding system property values.

  Parameters:
    `text` - the String to resolve
  Returns:
    the resolved String
  Throws:
    `java.lang.IllegalArgumentException` - if there is an unresolvable placeholder
  See Also:
    `PLACEHOLDER_PREFIX`, `PLACEHOLDER_SUFFIX`

### resolvePlaceholders

    public static java.lang.String resolvePlaceholders(java.lang.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 to true.

  Parameters:
    `text` - the String to resolve
    `ignoreUnresolvablePlaceholders` - flag to determine is unresolved placeholders are ignored
  Returns:
    the resolved String
  Throws:
    `java.lang.IllegalArgumentException` - if there is an unresolvable placeholder and the flag is false
  See Also:
    `PLACEHOLDER_PREFIX`, `PLACEHOLDER_SUFFIX`

Overview | Package | Class | Tree | Deprecated | Index | Help
| Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD