Don't resolve ConfigurationProperties placeholders
Revert commit 3ad43e0d44 to give us
a little more time to consider how this will impact tooling.
This commit is contained in:
parent
6e0f1f3d98
commit
191204fadb
|
|
@ -289,7 +289,6 @@ public class ConfigurationPropertiesBindingPostProcessor implements BeanPostProc
|
||||||
String targetName = (StringUtils.hasLength(annotation.value()) ? annotation
|
String targetName = (StringUtils.hasLength(annotation.value()) ? annotation
|
||||||
.value() : annotation.prefix());
|
.value() : annotation.prefix());
|
||||||
if (StringUtils.hasLength(targetName)) {
|
if (StringUtils.hasLength(targetName)) {
|
||||||
targetName = this.environment.resolvePlaceholders(targetName);
|
|
||||||
factory.setTargetName(targetName);
|
factory.setTargetName(targetName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -148,16 +148,6 @@ public class ConfigurationPropertiesBindingPostProcessorTests {
|
||||||
equalTo("foo"));
|
equalTo("foo"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void placeholderInPrefix() throws Exception {
|
|
||||||
this.context = new AnnotationConfigApplicationContext();
|
|
||||||
EnvironmentTestUtils.addEnvironment(this.context, "foo:spam", "spam.foo:bar");
|
|
||||||
this.context.register(PlaceholderPrefixConfiguration.class);
|
|
||||||
this.context.refresh();
|
|
||||||
assertThat(this.context.getBean(PlaceholderPrefixConfiguration.class).getFoo(),
|
|
||||||
equalTo("bar"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void placeholderResolutionWithCustomLocation() throws Exception {
|
public void placeholderResolutionWithCustomLocation() throws Exception {
|
||||||
this.context = new AnnotationConfigApplicationContext();
|
this.context = new AnnotationConfigApplicationContext();
|
||||||
|
|
@ -383,22 +373,6 @@ public class ConfigurationPropertiesBindingPostProcessorTests {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EnableConfigurationProperties
|
|
||||||
@ConfigurationProperties(prefix = "${foo:bar}")
|
|
||||||
public static class PlaceholderPrefixConfiguration {
|
|
||||||
|
|
||||||
private String foo;
|
|
||||||
|
|
||||||
public String getFoo() {
|
|
||||||
return this.foo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFoo(String foo) {
|
|
||||||
this.foo = foo;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@EnableConfigurationProperties
|
@EnableConfigurationProperties
|
||||||
@ConfigurationProperties(locations = "custom-location.yml")
|
@ConfigurationProperties(locations = "custom-location.yml")
|
||||||
public static class CustomConfigurationLocation {
|
public static class CustomConfigurationLocation {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue