Skip to content

Commit

Permalink
Use configuration resolver to replace standard resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
terminux committed Apr 7, 2023
1 parent 12537c7 commit a2d0dc8
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@
import java.nio.charset.StandardCharsets;
import java.util.function.BiConsumer;

import org.springframework.boot.context.properties.source.ConfigurationPropertySources;
import org.springframework.boot.system.ApplicationPid;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.ConfigurablePropertyResolver;
import org.springframework.core.env.Environment;
import org.springframework.core.env.PropertyResolver;
import org.springframework.core.env.PropertySourcesPropertyResolver;
import org.springframework.util.Assert;

/**
Expand Down Expand Up @@ -162,8 +163,7 @@ protected void apply(LogFile logFile, PropertyResolver resolver) {

private PropertyResolver getPropertyResolver() {
if (this.environment instanceof ConfigurableEnvironment configurableEnvironment) {
PropertySourcesPropertyResolver resolver = new PropertySourcesPropertyResolver(
configurableEnvironment.getPropertySources());
ConfigurablePropertyResolver resolver = ConfigurationPropertySources.createPropertyResolver(configurableEnvironment.getPropertySources());
resolver.setConversionService(((ConfigurableEnvironment) this.environment).getConversionService());
resolver.setIgnoreUnresolvableNestedPlaceholders(true);
return resolver;
Expand Down

0 comments on commit a2d0dc8

Please sign in to comment.