|
|
@ -163,7 +163,7 @@ public class ConfigFileApplicationListenerTests {
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void yamlProfileCanBeChanged() throws Exception {
|
|
|
|
public void yamlProfileCanBeChanged() throws Exception {
|
|
|
|
EnvironmentTestUtils.addEnviroment(this.environment,
|
|
|
|
EnvironmentTestUtils.addEnvironment(this.environment,
|
|
|
|
"spring.profiles.active:prod");
|
|
|
|
"spring.profiles.active:prod");
|
|
|
|
this.initializer.setNames("testsetprofiles");
|
|
|
|
this.initializer.setNames("testsetprofiles");
|
|
|
|
this.initializer.onApplicationEvent(this.event);
|
|
|
|
this.initializer.onApplicationEvent(this.event);
|
|
|
@ -186,7 +186,7 @@ public class ConfigFileApplicationListenerTests {
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void specificResource() throws Exception {
|
|
|
|
public void specificResource() throws Exception {
|
|
|
|
String location = "classpath:specificlocation.properties";
|
|
|
|
String location = "classpath:specificlocation.properties";
|
|
|
|
EnvironmentTestUtils.addEnviroment(this.environment, "spring.config.location:"
|
|
|
|
EnvironmentTestUtils.addEnvironment(this.environment, "spring.config.location:"
|
|
|
|
+ location);
|
|
|
|
+ location);
|
|
|
|
this.initializer.onApplicationEvent(this.event);
|
|
|
|
this.initializer.onApplicationEvent(this.event);
|
|
|
|
String property = this.environment.getProperty("my.property");
|
|
|
|
String property = this.environment.getProperty("my.property");
|
|
|
@ -202,7 +202,7 @@ public class ConfigFileApplicationListenerTests {
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void specificResourceAsFile() throws Exception {
|
|
|
|
public void specificResourceAsFile() throws Exception {
|
|
|
|
String location = "file:src/test/resources/specificlocation.properties";
|
|
|
|
String location = "file:src/test/resources/specificlocation.properties";
|
|
|
|
EnvironmentTestUtils.addEnviroment(this.environment, "spring.config.location:"
|
|
|
|
EnvironmentTestUtils.addEnvironment(this.environment, "spring.config.location:"
|
|
|
|
+ location);
|
|
|
|
+ location);
|
|
|
|
this.initializer.onApplicationEvent(this.event);
|
|
|
|
this.initializer.onApplicationEvent(this.event);
|
|
|
|
assertThat(this.environment.getPropertySources().contains(location), is(true));
|
|
|
|
assertThat(this.environment.getPropertySources().contains(location), is(true));
|
|
|
@ -239,7 +239,7 @@ public class ConfigFileApplicationListenerTests {
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void specificResourceDefaultsToFile() throws Exception {
|
|
|
|
public void specificResourceDefaultsToFile() throws Exception {
|
|
|
|
String location = "src/test/resources/specificlocation.properties";
|
|
|
|
String location = "src/test/resources/specificlocation.properties";
|
|
|
|
EnvironmentTestUtils.addEnviroment(this.environment, "spring.config.location:"
|
|
|
|
EnvironmentTestUtils.addEnvironment(this.environment, "spring.config.location:"
|
|
|
|
+ location);
|
|
|
|
+ location);
|
|
|
|
this.initializer.onApplicationEvent(this.event);
|
|
|
|
this.initializer.onApplicationEvent(this.event);
|
|
|
|
assertThat(this.environment.getPropertySources().contains("file:" + location),
|
|
|
|
assertThat(this.environment.getPropertySources().contains("file:" + location),
|
|
|
|