diff --git a/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileApplicationListenerTests.java b/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileApplicationListenerTests.java index 0257b768ea9..0e24edc573a 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileApplicationListenerTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileApplicationListenerTests.java @@ -110,6 +110,19 @@ public class ConfigFileApplicationListenerTests { assertThat(property, equalTo("fromotherpropertiesfile")); } + @Test + public void loadTwoPropertiesFilesWithProfilesAndSwitchOneOff() throws Exception { + EnvironmentTestUtils.addEnvironment(this.environment, "spring.config.location:" + + "classpath:enabletwoprofiles.properties," + + "classpath:enableprofile.properties"); + this.initializer.onApplicationEvent(this.event); + assertEquals("myprofile", + StringUtils.arrayToCommaDelimitedString(this.environment + .getActiveProfiles())); + String property = this.environment.getProperty("my.property"); + assertThat(property, equalTo("fromtwopropertiesfile")); + } + @Test public void localFileTakesPrecedenceOverClasspath() throws Exception { File localFile = new File(new File("."), "application.properties"); diff --git a/spring-boot/src/test/resources/enabletwoprofiles.properties b/spring-boot/src/test/resources/enabletwoprofiles.properties new file mode 100644 index 00000000000..90d74d0f417 --- /dev/null +++ b/spring-boot/src/test/resources/enabletwoprofiles.properties @@ -0,0 +1,2 @@ +spring.profiles.active=myprofile,another +my.property=fromtwopropertiesfile