|
|
|
@ -109,6 +109,17 @@ public class EnableConfigurationPropertiesTests {
|
|
|
|
|
assertEquals("foo", this.context.getBean(TestProperties.class).name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testPropertiesEmbeddedBinding() {
|
|
|
|
|
this.context.register(EmbeddedTestConfiguration.class);
|
|
|
|
|
TestUtils.addEnviroment(this.context, "spring_foo_name:foo");
|
|
|
|
|
this.context.refresh();
|
|
|
|
|
assertEquals(1,
|
|
|
|
|
this.context.getBeanNamesForType(EmbeddedTestProperties.class).length);
|
|
|
|
|
assertEquals("foo", this.context.getBean(TestProperties.class).name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testIgnoreNestedPropertiesBinding() {
|
|
|
|
|
this.context.register(IgnoreNestedTestConfiguration.class);
|
|
|
|
@ -287,6 +298,10 @@ public class EnableConfigurationPropertiesTests {
|
|
|
|
|
protected static class StrictTestConfiguration {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Configuration
|
|
|
|
|
@EnableConfigurationProperties(EmbeddedTestProperties.class)
|
|
|
|
|
protected static class EmbeddedTestConfiguration {
|
|
|
|
|
}
|
|
|
|
|
@Configuration
|
|
|
|
|
@EnableConfigurationProperties(IgnoreNestedTestProperties.class)
|
|
|
|
|
protected static class IgnoreNestedTestConfiguration {
|
|
|
|
@ -410,6 +425,10 @@ public class EnableConfigurationPropertiesTests {
|
|
|
|
|
@ConfigurationProperties(ignoreUnknownFields = false)
|
|
|
|
|
protected static class StrictTestProperties extends TestProperties {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
@ConfigurationProperties(name = "spring.foo")
|
|
|
|
|
protected static class EmbeddedTestProperties extends TestProperties {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ConfigurationProperties(ignoreUnknownFields = false, ignoreNestedProperties = true)
|
|
|
|
|