public abstract class

SystemPropertyUtils

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

Class Overview

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.

Summary

Constants
String PLACEHOLDER_PREFIX Prefix for system property placeholders: "${"
String PLACEHOLDER_SUFFIX Suffix for system property placeholders: "}"
String VALUE_SEPARATOR Value separator for system property placeholders: ":"
Public Constructors
SystemPropertyUtils()
Public Methods
static String resolvePlaceholders(String text, boolean ignoreUnresolvablePlaceholders)
Resolve ${...} placeholders in the given text, replacing them with corresponding system property values.
static String resolvePlaceholders(String text)
Resolve ${...} placeholders in the given text, replacing them with corresponding system property values.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String PLACEHOLDER_PREFIX

Also: SpringCore

Prefix for system property placeholders: "${"

Constant Value: "${"

public static final String PLACEHOLDER_SUFFIX

Also: SpringCore

Suffix for system property placeholders: "}"

Constant Value: "}"

public static final String VALUE_SEPARATOR

Also: SpringCore

Value separator for system property placeholders: ":"

Constant Value: ":"

Public Constructors

public SystemPropertyUtils ()

Also: SpringCore

Public Methods

public static String resolvePlaceholders (String text, boolean ignoreUnresolvablePlaceholders)

Also: SpringCore

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
IllegalArgumentException if there is an unresolvable placeholder and the flag is false

public static String resolvePlaceholders (String text)

Also: SpringCore

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

Parameters
text the String to resolve
Returns
  • the resolved String
Throws
IllegalArgumentException if there is an unresolvable placeholder