Merge branch '2.0.x'
This commit is contained in:
commit
3a01914b63
|
@ -371,8 +371,8 @@ public class ConfigFileApplicationListener
|
|||
}
|
||||
Binder binder = Binder.get(this.environment);
|
||||
Set<Profile> activeProfiles = new LinkedHashSet<>();
|
||||
activeProfiles.addAll(getProfiles(binder, ACTIVE_PROFILES_PROPERTY));
|
||||
activeProfiles.addAll(getProfiles(binder, INCLUDE_PROFILES_PROPERTY));
|
||||
activeProfiles.addAll(getProfiles(binder, ACTIVE_PROFILES_PROPERTY));
|
||||
return activeProfiles;
|
||||
}
|
||||
|
||||
|
|
|
@ -401,6 +401,18 @@ public class ConfigFileApplicationListenerTests {
|
|||
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
|
||||
public void profilesAddedToEnvironmentAndViaPropertyDuplicate() {
|
||||
TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.environment,
|
||||
|
|
Loading…
Reference in New Issue