From e34cdc2a558752435e3db9b14fd927e83720d7f2 Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Mon, 12 May 2025 17:25:49 +0200 Subject: [PATCH] Improve Javadoc for property placeholder support --- .../config/PlaceholderConfigurerSupport.java | 7 +++-- .../core/env/AbstractPropertyResolver.java | 28 ++++++++----------- .../util/SystemPropertyUtils.java | 13 +++++---- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/PlaceholderConfigurerSupport.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/PlaceholderConfigurerSupport.java index bc9ef117c11..6d1fd92d97b 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/config/PlaceholderConfigurerSupport.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/PlaceholderConfigurerSupport.java @@ -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. - *
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) { diff --git a/spring-core/src/main/java/org/springframework/core/env/AbstractPropertyResolver.java b/spring-core/src/main/java/org/springframework/core/env/AbstractPropertyResolver.java index eae36deddce..72d655757e6 100644 --- a/spring-core/src/main/java/org/springframework/core/env/AbstractPropertyResolver.java +++ b/spring-core/src/main/java/org/springframework/core/env/AbstractPropertyResolver.java @@ -91,9 +91,9 @@ public abstract class AbstractPropertyResolver implements ConfigurablePropertyRe } /** - * Set the prefix that placeholders replaced by this resolver must begin with. - *
The default is "${". - * @see org.springframework.util.SystemPropertyUtils#PLACEHOLDER_PREFIX + * {@inheritDoc} + *
The default is "${".
+ * @see SystemPropertyUtils#PLACEHOLDER_PREFIX
*/
@Override
public void setPlaceholderPrefix(String placeholderPrefix) {
@@ -102,9 +102,9 @@ public abstract class AbstractPropertyResolver implements ConfigurablePropertyRe
}
/**
- * Set the suffix that placeholders replaced by this resolver must end with.
- *
The default is "}". - * @see org.springframework.util.SystemPropertyUtils#PLACEHOLDER_SUFFIX + * {@inheritDoc} + *
The default is "}".
+ * @see SystemPropertyUtils#PLACEHOLDER_SUFFIX
*/
@Override
public void setPlaceholderSuffix(String placeholderSuffix) {
@@ -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.
- *
The default is ":". - * @see org.springframework.util.SystemPropertyUtils#VALUE_SEPARATOR + * {@inheritDoc} + *
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 } /** - * Specify the escape character to use to ignore placeholder prefix - * or value separator, or {@code null} if no escaping should take - * place. - *
The default is '\'. + * {@inheritDoc} + *
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) { diff --git a/spring-core/src/main/java/org/springframework/util/SystemPropertyUtils.java b/spring-core/src/main/java/org/springframework/util/SystemPropertyUtils.java index eb962efc5bb..fae3b69934b 100644 --- a/spring-core/src/main/java/org/springframework/util/SystemPropertyUtils.java +++ b/spring-core/src/main/java/org/springframework/util/SystemPropertyUtils.java @@ -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; */ 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 = '\\';