Deprecate [Property|Preferences]PlaceholderConfigurer for removal

PropertyPlaceholderConfigurer and PreferencesPlaceholderConfigurer have
been officially deprecated since Spring Framework 5.2.

Since we no longer expect applications to depend on these outdated
mechanisms, this commit deprecates these classes "for removal" in
Spring Framework 8.0.

Closes gh-34880
This commit is contained in:
Sam Brannen
2025-05-11 17:01:04 +02:00
parent c7787b8383
commit 33aeb6ee9c
11 changed files with 32 additions and 29 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 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.
@@ -26,8 +26,8 @@ import org.springframework.beans.factory.BeanDefinitionStoreException;
import org.springframework.beans.factory.InitializingBean;
/**
* Subclass of PropertyPlaceholderConfigurer that supports JDK 1.4's
* Preferences API ({@code java.util.prefs}).
* Subclass of {@link PropertyPlaceholderConfigurer} that supports JDK 1.4's
* {@link Preferences} API.
*
* <p>Tries to resolve placeholders as keys first in the user preferences,
* then in the system preferences, then in this configurer's properties.
@@ -43,9 +43,10 @@ import org.springframework.beans.factory.InitializingBean;
* @see #setSystemTreePath
* @see #setUserTreePath
* @see java.util.prefs.Preferences
* @deprecated as of 5.2, along with {@link PropertyPlaceholderConfigurer}
* @deprecated as of 5.2, along with {@link PropertyPlaceholderConfigurer}; to be removed in 8.0
*/
@Deprecated
@Deprecated(since = "5.2", forRemoval = true)
@SuppressWarnings({"deprecation", "removal"})
public class PreferencesPlaceholderConfigurer extends PropertyPlaceholderConfigurer implements InitializingBean {
private @Nullable String systemTreePath;

View File

@@ -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.
@@ -52,11 +52,13 @@ import org.springframework.util.StringValueResolver;
* @see #setSystemPropertiesModeName
* @see PlaceholderConfigurerSupport
* @see PropertyOverrideConfigurer
* @deprecated as of 5.2; use {@code org.springframework.context.support.PropertySourcesPlaceholderConfigurer}
* instead which is more flexible through taking advantage of the {@link org.springframework.core.env.Environment}
* and {@link org.springframework.core.env.PropertySource} mechanisms.
* @deprecated as of 5.2, to be removed in 8.0;
* use {@code org.springframework.context.support.PropertySourcesPlaceholderConfigurer}
* instead which is more flexible through taking advantage of the
* {@link org.springframework.core.env.Environment} and
* {@link org.springframework.core.env.PropertySource} mechanisms.
*/
@Deprecated
@Deprecated(since = "5.2", forRemoval = true)
public class PropertyPlaceholderConfigurer extends PlaceholderConfigurerSupport {
/** Never check system properties. */

View File

@@ -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.
@@ -44,7 +44,7 @@ import static org.springframework.beans.factory.support.BeanDefinitionReaderUtil
* @author Chris Beams
* @author Sam Brannen
*/
@SuppressWarnings("deprecation")
@SuppressWarnings({"deprecation", "removal"})
class PropertyPlaceholderConfigurerTests {
private static final String P1 = "p1";

View File

@@ -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.
@@ -59,7 +59,7 @@ import static org.springframework.core.testfixture.io.ResourceTestUtils.qualifie
* @since 02.10.2003
* @see PropertyPlaceholderConfigurerTests
*/
@SuppressWarnings("deprecation")
@SuppressWarnings({"deprecation", "removal"})
class PropertyResourceConfigurerTests {
static {