|
|
|
@ -110,6 +110,19 @@ public class ConfigFileApplicationListenerTests { |
|
|
|
assertThat(property, equalTo("fromotherpropertiesfile")); |
|
|
|
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 |
|
|
|
@Test |
|
|
|
public void localFileTakesPrecedenceOverClasspath() throws Exception { |
|
|
|
public void localFileTakesPrecedenceOverClasspath() throws Exception { |
|
|
|
File localFile = new File(new File("."), "application.properties"); |
|
|
|
File localFile = new File(new File("."), "application.properties"); |
|
|
|
|