Commit a8daed81 authored by Andy Wilkinson's avatar Andy Wilkinson

Merge branch '1.5.x'

parents ef24f797 7dd8e8c4
......@@ -342,7 +342,8 @@ public class ConfigFileApplicationListener implements EnvironmentPostProcessor,
}
private Set<Profile> initializeActiveProfiles() {
if (!this.environment.containsProperty(ACTIVE_PROFILES_PROPERTY)) {
if (!this.environment.containsProperty(ACTIVE_PROFILES_PROPERTY)
&& !this.environment.containsProperty(INCLUDE_PROFILES_PROPERTY)) {
return Collections.emptySet();
}
// Any pre-existing active profiles set via property sources (e.g. System
......
......@@ -806,6 +806,15 @@ public class ConfigFileApplicationListenerTests {
.isFalse();
}
@Test
public void profileCanBeIncludedWithoutAnyBeingActive() throws Exception {
SpringApplication application = new SpringApplication(Config.class);
application.setWebEnvironment(false);
this.context = application.run("--spring.profiles.include=dev");
String property = this.context.getEnvironment().getProperty("my.property");
assertThat(property).isEqualTo("fromdevpropertiesfile");
}
@Test
public void activeProfilesCanBeConfiguredUsingPlaceholdersResolvedAgainstTheEnvironment()
throws Exception {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment