Commit 3a01914b authored by Madhura Bhave's avatar Madhura Bhave

Merge branch '2.0.x'

parents 165d993e 87680b4e
...@@ -371,8 +371,8 @@ public class ConfigFileApplicationListener ...@@ -371,8 +371,8 @@ public class ConfigFileApplicationListener
} }
Binder binder = Binder.get(this.environment); Binder binder = Binder.get(this.environment);
Set<Profile> activeProfiles = new LinkedHashSet<>(); Set<Profile> activeProfiles = new LinkedHashSet<>();
activeProfiles.addAll(getProfiles(binder, ACTIVE_PROFILES_PROPERTY));
activeProfiles.addAll(getProfiles(binder, INCLUDE_PROFILES_PROPERTY)); activeProfiles.addAll(getProfiles(binder, INCLUDE_PROFILES_PROPERTY));
activeProfiles.addAll(getProfiles(binder, ACTIVE_PROFILES_PROPERTY));
return activeProfiles; return activeProfiles;
} }
......
...@@ -401,6 +401,18 @@ public class ConfigFileApplicationListenerTests { ...@@ -401,6 +401,18 @@ public class ConfigFileApplicationListenerTests {
validateProfilePrecedence(null, "dev", "other"); validateProfilePrecedence(null, "dev", "other");
} }
@Test
public void profilesAddedToEnvironmentViaActiveAndIncludeProperty() {
// Active profile property takes precedence
TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.environment,
"spring.profiles.active=dev", "spring.profiles.include=other");
this.initializer.postProcessEnvironment(this.environment, this.application);
assertThat(this.environment.getActiveProfiles()).contains("dev", "other");
assertThat(this.environment.getProperty("my.property"))
.isEqualTo("fromdevpropertiesfile");
validateProfilePrecedence(null, "other", "dev");
}
@Test @Test
public void profilesAddedToEnvironmentAndViaPropertyDuplicate() { public void profilesAddedToEnvironmentAndViaPropertyDuplicate() {
TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.environment, TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.environment,
......
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