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 6a09f4d
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -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 6a09f4d

Please sign in to comment.