spring-framework / org.springframework.util / SystemPropertyUtils

SystemPropertyUtils

abstract class SystemPropertyUtils

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.

Author
Juergen Hoeller

Author
Rob Harrop

Author
Dave Syer

Since
1.2.5

See Also
#PLACEHOLDER_PREFIX#PLACEHOLDER_SUFFIXSystem#getProperty(String)

Constructors

<init>

SystemPropertyUtils()

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.

Properties

PLACEHOLDER_PREFIX

static val PLACEHOLDER_PREFIX: String

Prefix for system property placeholders: "${"

PLACEHOLDER_SUFFIX

static val PLACEHOLDER_SUFFIX: String

Suffix for system property placeholders: "}"

VALUE_SEPARATOR

static val VALUE_SEPARATOR: String

Value separator for system property placeholders: ":"

Functions

resolvePlaceholders

open static fun resolvePlaceholders(text: String): String

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

open static fun resolvePlaceholders(text: String, ignoreUnresolvablePlaceholders: Boolean): String

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.