Apply "instanceof pattern matching" in PropertySourcesPlaceholderConfigurer

See gh-27947
This commit is contained in:
Sam Brannen 2022-01-18 16:23:41 +01:00
parent d72cf89ebf
commit e565d2cabb
1 changed files with 2 additions and 2 deletions

View File

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