From a615693f39fcc78d2bec4ea65429ec5168310601 Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Wed, 9 Apr 2014 06:59:05 +0100 Subject: [PATCH] Add test for gh-645 --- .../config/ConfigFileApplicationListenerTests.java | 11 +++++++++++ spring-boot/src/test/resources/testprofiles.yml | 7 ++++++- 2 files changed, 17 insertions(+), 1 deletion(-) 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 aa7cd18bbd9..fb747169148 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 @@ -318,6 +318,17 @@ public class ConfigFileApplicationListenerTests { assertThat(property, equalTo("notempty")); } + @Test + public void yamlTwoProfiles() throws Exception { + this.initializer.setSearchNames("testprofiles"); + this.environment.setActiveProfiles("other", "dev"); + this.initializer.onApplicationEvent(this.event); + String property = this.environment.getProperty("my.property"); + assertThat(property, equalTo("fromotherprofile")); + property = this.environment.getProperty("my.other"); + assertThat(property, equalTo("notempty")); + } + @Test public void yamlSetsProfiles() throws Exception { this.initializer.setSearchNames("testsetprofiles"); diff --git a/spring-boot/src/test/resources/testprofiles.yml b/spring-boot/src/test/resources/testprofiles.yml index 1c301ba8b5c..74af5c33c15 100644 --- a/spring-boot/src/test/resources/testprofiles.yml +++ b/spring-boot/src/test/resources/testprofiles.yml @@ -6,4 +6,9 @@ my: spring: profiles: dev my: - property: fromdevprofile \ No newline at end of file + property: fromdevprofile +--- +spring: + profiles: other +my: + property: fromotherprofile \ No newline at end of file