consider spring.profiles.include values from bootstrap PropertySources (#123)

This commit is contained in:
Matt Benson
2017-01-26 11:14:43 -06:00
committed by Spencer Gibb
parent 625b906e53
commit 941275ded2
2 changed files with 57 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2014 the original author or authors.
* Copyright 2013-2016 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.
@@ -315,6 +315,15 @@ public class BootstrapConfigurationTests {
assertEquals("parent", this.context.getEnvironment().getProperty("info.name"));
}
@Test
public void includeProfileFromBootstrapPropertySource() {
PropertySourceConfiguration.MAP.put("spring.profiles.include", "bar,baz");
this.context = new SpringApplicationBuilder().web(false).profiles("foo")
.sources(BareConfiguration.class).run();
assertTrue(this.context.getEnvironment().acceptsProfiles("baz"));
assertTrue(this.context.getEnvironment().acceptsProfiles("bar"));
}
@Configuration
@EnableConfigurationProperties
protected static class BareConfiguration {