Browse Source

Improve Javadoc for property placeholder support

pull/35405/head
Sam Brannen 9 months ago
parent
commit
e34cdc2a55
  1. 7
      spring-beans/src/main/java/org/springframework/beans/factory/config/PlaceholderConfigurerSupport.java
  2. 28
      spring-core/src/main/java/org/springframework/core/env/AbstractPropertyResolver.java
  3. 13
      spring-core/src/main/java/org/springframework/util/SystemPropertyUtils.java

7
spring-beans/src/main/java/org/springframework/beans/factory/config/PlaceholderConfigurerSupport.java

@ -160,9 +160,10 @@ public abstract class PlaceholderConfigurerSupport extends PropertyResourceConfi @@ -160,9 +160,10 @@ public abstract class PlaceholderConfigurerSupport extends PropertyResourceConfi
}
/**
* Specify the escape character to use to ignore the placeholder prefix or
* value separator, or {@code null} if no escaping should take place.
* <p>Default is {@link #DEFAULT_ESCAPE_CHARACTER}.
* Set the escape character to use to ignore the
* {@linkplain #setPlaceholderPrefix(String) placeholder prefix} and the
* {@linkplain #setValueSeparator(String) value separator}, or {@code null}
* if no escaping should take place.
* @since 6.2
*/
public void setEscapeCharacter(@Nullable Character escapeCharacter) {

28
spring-core/src/main/java/org/springframework/core/env/AbstractPropertyResolver.java vendored

@ -91,9 +91,9 @@ public abstract class AbstractPropertyResolver implements ConfigurablePropertyRe @@ -91,9 +91,9 @@ public abstract class AbstractPropertyResolver implements ConfigurablePropertyRe
}
/**
* Set the prefix that placeholders replaced by this resolver must begin with.
* <p>The default is "${".
* @see org.springframework.util.SystemPropertyUtils#PLACEHOLDER_PREFIX
* {@inheritDoc}
* <p>The default is <code>"${"</code>.
* @see SystemPropertyUtils#PLACEHOLDER_PREFIX
*/
@Override
public void setPlaceholderPrefix(String placeholderPrefix) {
@ -102,9 +102,9 @@ public abstract class AbstractPropertyResolver implements ConfigurablePropertyRe @@ -102,9 +102,9 @@ public abstract class AbstractPropertyResolver implements ConfigurablePropertyRe
}
/**
* Set the suffix that placeholders replaced by this resolver must end with.
* <p>The default is "}".
* @see org.springframework.util.SystemPropertyUtils#PLACEHOLDER_SUFFIX
* {@inheritDoc}
* <p>The default is <code>"}"</code>.
* @see SystemPropertyUtils#PLACEHOLDER_SUFFIX
*/
@Override
public void setPlaceholderSuffix(String placeholderSuffix) {
@ -113,11 +113,9 @@ public abstract class AbstractPropertyResolver implements ConfigurablePropertyRe @@ -113,11 +113,9 @@ public abstract class AbstractPropertyResolver implements ConfigurablePropertyRe
}
/**
* Specify the separating character between the placeholders replaced by this
* resolver and their associated default value, or {@code null} if no such
* special character should be processed as a value separator.
* <p>The default is ":".
* @see org.springframework.util.SystemPropertyUtils#VALUE_SEPARATOR
* {@inheritDoc}
* <p>The default is {@code ":"}.
* @see SystemPropertyUtils#VALUE_SEPARATOR
*/
@Override
public void setValueSeparator(@Nullable String valueSeparator) {
@ -125,12 +123,10 @@ public abstract class AbstractPropertyResolver implements ConfigurablePropertyRe @@ -125,12 +123,10 @@ public abstract class AbstractPropertyResolver implements ConfigurablePropertyRe
}
/**
* Specify the escape character to use to ignore placeholder prefix
* or value separator, or {@code null} if no escaping should take
* place.
* <p>The default is '\'.
* {@inheritDoc}
* <p>The default is {@code '\'}.
* @since 6.2
* @see org.springframework.util.SystemPropertyUtils#ESCAPE_CHARACTER
* @see SystemPropertyUtils#ESCAPE_CHARACTER
*/
@Override
public void setEscapeCharacter(@Nullable Character escapeCharacter) {

13
spring-core/src/main/java/org/springframework/util/SystemPropertyUtils.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -35,16 +35,19 @@ import org.springframework.lang.Nullable; @@ -35,16 +35,19 @@ import org.springframework.lang.Nullable;
*/
public abstract class SystemPropertyUtils {
/** Prefix for system property placeholders: {@value}. */
/** Prefix for property placeholders: {@value}. */
public static final String PLACEHOLDER_PREFIX = "${";
/** Suffix for system property placeholders: {@value}. */
/** Suffix for property placeholders: {@value}. */
public static final String PLACEHOLDER_SUFFIX = "}";
/** Value separator for system property placeholders: {@value}. */
/** Value separator for property placeholders: {@value}. */
public static final String VALUE_SEPARATOR = ":";
/** Default escape character: {@code '\'}. */
/**
* Escape character for property placeholders: {@code '\'}.
* @since 6.2
*/
public static final Character ESCAPE_CHARACTER = '\\';

Loading…
Cancel
Save