Add test for profiles picked up from bootstrap.properties

This commit is contained in:
Dave Syer
2017-11-14 11:53:49 +00:00
parent 1b219b086c
commit 4352d9a81a
2 changed files with 10 additions and 0 deletions

View File

@@ -370,6 +370,15 @@ public class BootstrapConfigurationTests {
assertTrue(this.context.getEnvironment().acceptsProfiles("bar"));
}
@Test
public void includeProfileFromBootstrapProperties() {
this.context = new SpringApplicationBuilder().web(false)
.sources(BareConfiguration.class)
.properties("spring.cloud.bootstrap.name=local").run();
assertTrue(this.context.getEnvironment().acceptsProfiles("local"));
assertEquals("Hello added!", this.context.getEnvironment().getProperty("added"));
}
@Configuration
@EnableConfigurationProperties
protected static class BareConfiguration {