|
|
@ -101,6 +101,16 @@ public class EnableConfigurationPropertiesTests {
|
|
|
|
assertEquals("bar", this.context.getBean(NestedProperties.class).nested.name);
|
|
|
|
assertEquals("bar", this.context.getBean(NestedProperties.class).nested.name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
|
|
|
public void testNestedOsEnvironmentVariableWithUnderscore() {
|
|
|
|
|
|
|
|
EnvironmentTestUtils.addEnvironment(this.context, "NAME:foo", "NESTED_NAME:bar");
|
|
|
|
|
|
|
|
this.context.register(NestedConfiguration.class);
|
|
|
|
|
|
|
|
this.context.refresh();
|
|
|
|
|
|
|
|
assertEquals(1, this.context.getBeanNamesForType(NestedProperties.class).length);
|
|
|
|
|
|
|
|
assertEquals("foo", this.context.getBean(NestedProperties.class).name);
|
|
|
|
|
|
|
|
assertEquals("bar", this.context.getBean(NestedProperties.class).nested.name);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void testStrictPropertiesBinding() {
|
|
|
|
public void testStrictPropertiesBinding() {
|
|
|
|
removeSystemProperties();
|
|
|
|
removeSystemProperties();
|
|
|
@ -122,6 +132,16 @@ public class EnableConfigurationPropertiesTests {
|
|
|
|
assertEquals("foo", this.context.getBean(TestProperties.class).name);
|
|
|
|
assertEquals("foo", this.context.getBean(TestProperties.class).name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
|
|
|
public void testOsEnvironmentVariableEmbeddedBinding() {
|
|
|
|
|
|
|
|
EnvironmentTestUtils.addEnvironment(this.context, "SPRING_FOO_NAME:foo");
|
|
|
|
|
|
|
|
this.context.register(EmbeddedTestConfiguration.class);
|
|
|
|
|
|
|
|
this.context.refresh();
|
|
|
|
|
|
|
|
assertEquals(1,
|
|
|
|
|
|
|
|
this.context.getBeanNamesForType(EmbeddedTestProperties.class).length);
|
|
|
|
|
|
|
|
assertEquals("foo", this.context.getBean(TestProperties.class).name);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void testIgnoreNestedPropertiesBinding() {
|
|
|
|
public void testIgnoreNestedPropertiesBinding() {
|
|
|
|
removeSystemProperties();
|
|
|
|
removeSystemProperties();
|
|
|
|