From e565d2cabb01539933195b0d1bc3b55992fb9c84 Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Tue, 18 Jan 2022 16:23:41 +0100 Subject: [PATCH] Apply "instanceof pattern matching" in PropertySourcesPlaceholderConfigurer See gh-27947 --- .../context/support/PropertySourcesPlaceholderConfigurer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 bb0e79791f64..293c4fa2f269 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 void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) // 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);