diff --git a/spring-context/src/main/java/org/springframework/context/support/PropertySourcesPlaceholderConfigurer.java b/spring-context/src/main/java/org/springframework/context/support/PropertySourcesPlaceholderConfigurer.java index 94ed316e2d0..2a7e348a27f 100644 --- a/spring-context/src/main/java/org/springframework/context/support/PropertySourcesPlaceholderConfigurer.java +++ b/spring-context/src/main/java/org/springframework/context/support/PropertySourcesPlaceholderConfigurer.java @@ -225,18 +225,14 @@ public class PropertySourcesPlaceholderConfigurer extends PlaceholderConfigurerS */ private static class ConfigurableEnvironmentPropertySource extends PropertySource { - private final PropertySources propertySources; - - ConfigurableEnvironmentPropertySource(ConfigurableEnvironment environment) { super(ENVIRONMENT_PROPERTIES_PROPERTY_SOURCE_NAME, environment); - this.propertySources = environment.getPropertySources(); } @Override public @Nullable Object getProperty(String name) { - for (PropertySource propertySource : this.propertySources) { + for (PropertySource propertySource : super.source.getPropertySources()) { Object candidate = propertySource.getProperty(name); if (candidate != null) { return candidate; @@ -247,7 +243,7 @@ public class PropertySourcesPlaceholderConfigurer extends PlaceholderConfigurerS @Override public boolean containsProperty(String name) { - for (PropertySource propertySource : this.propertySources) { + for (PropertySource propertySource : super.source.getPropertySources()) { if (propertySource.containsProperty(name)) { return true; } @@ -257,7 +253,7 @@ public class PropertySourcesPlaceholderConfigurer extends PlaceholderConfigurerS @Override public String toString() { - return "ConfigurableEnvironmentPropertySource {propertySources=" + this.propertySources + "}"; + return "ConfigurableEnvironmentPropertySource {propertySources=" + super.source.getPropertySources() + "}"; } }