Browse Source

Deprecate PropertyPlaceholderConfigurer

This commit deprecates PropertyPlaceholderConfigurer in favor of
PropertySourcesPlaceholderConfigurer.

Closes gh-22181
pull/22372/head
Sebastien Deleuze 7 years ago
parent
commit
3787b23a98
  1. 11
      spring-beans/src/main/java/org/springframework/beans/factory/config/PropertyPlaceholderConfigurer.java
  2. 4
      spring-context/src/main/java/org/springframework/context/config/PropertyPlaceholderBeanDefinitionParser.java

11
spring-beans/src/main/java/org/springframework/beans/factory/config/PropertyPlaceholderConfigurer.java

@ -32,11 +32,6 @@ import org.springframework.util.StringValueResolver; @@ -32,11 +32,6 @@ import org.springframework.util.StringValueResolver;
* {@link #setLocation local} {@link #setProperties properties} and/or system properties
* and environment variables.
*
* <p>As of Spring 3.1, {@link org.springframework.context.support.PropertySourcesPlaceholderConfigurer
* PropertySourcesPlaceholderConfigurer} should be used preferentially over this implementation; it is
* more flexible through taking advantage of the {@link org.springframework.core.env.Environment} and
* {@link org.springframework.core.env.PropertySource} mechanisms also made available in Spring 3.1.
*
* <p>{@link PropertyPlaceholderConfigurer} is still appropriate for use when:
* <ul>
* <li>the {@code spring-context} module is not available (i.e., one is using Spring's
@ -54,8 +49,12 @@ import org.springframework.util.StringValueResolver; @@ -54,8 +49,12 @@ import org.springframework.util.StringValueResolver;
* @see #setSystemPropertiesModeName
* @see PlaceholderConfigurerSupport
* @see PropertyOverrideConfigurer
* @see org.springframework.context.support.PropertySourcesPlaceholderConfigurer
* @deprecated use {@code org.springframework.context.support.PropertySourcesPlaceholderConfigurer} instead;
* it is more flexible through taking advantage of the {@link org.springframework.core.env.Environment} and
* {@link org.springframework.core.env.PropertySource} mechanisms.
*/
@Deprecated
public class PropertyPlaceholderConfigurer extends PlaceholderConfigurerSupport {
/** Never check system properties. */

4
spring-context/src/main/java/org/springframework/context/config/PropertyPlaceholderBeanDefinitionParser.java

@ -18,7 +18,6 @@ package org.springframework.context.config; @@ -18,7 +18,6 @@ package org.springframework.context.config;
import org.w3c.dom.Element;
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.xml.ParserContext;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
@ -40,6 +39,7 @@ class PropertyPlaceholderBeanDefinitionParser extends AbstractPropertyLoadingBea @@ -40,6 +39,7 @@ class PropertyPlaceholderBeanDefinitionParser extends AbstractPropertyLoadingBea
@Override
@SuppressWarnings("deprecation")
protected Class<?> getBeanClass(Element element) {
// As of Spring 3.1, the default value of system-properties-mode has changed from
// 'FALLBACK' to 'ENVIRONMENT'. This latter value indicates that resolution of
@ -51,7 +51,7 @@ class PropertyPlaceholderBeanDefinitionParser extends AbstractPropertyLoadingBea @@ -51,7 +51,7 @@ class PropertyPlaceholderBeanDefinitionParser extends AbstractPropertyLoadingBea
// The user has explicitly specified a value for system-properties-mode: revert to
// PropertyPlaceholderConfigurer to ensure backward compatibility with 3.0 and earlier.
return PropertyPlaceholderConfigurer.class;
return org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.class;
}
@Override

Loading…
Cancel
Save