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 bb0e79791f..293c4fa2f2 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 @@ -137,8 +137,8 @@ public class PropertySourcesPlaceholderConfigurer extends PlaceholderConfigurerS // local PropertyResolver to enforce that setting, since the Environment is most // likely not configured with ignoreUnresolvablePlaceholders set to true. // See https://github.com/spring-projects/spring-framework/issues/27947 - if (this.ignoreUnresolvablePlaceholders && (this.environment instanceof ConfigurableEnvironment)) { - ConfigurableEnvironment configurableEnvironment = (ConfigurableEnvironment) this.environment; + if (this.ignoreUnresolvablePlaceholders && + (this.environment instanceof ConfigurableEnvironment configurableEnvironment)) { PropertySourcesPropertyResolver resolver = new PropertySourcesPropertyResolver(configurableEnvironment.getPropertySources()); resolver.setIgnoreUnresolvableNestedPlaceholders(true);