Introduced property 'spring.cloud.bootstrap.additional-location' according to 'spring.config.additional-location' (#466)

This commit is contained in:
srempfer
2019-01-15 23:40:25 +01:00
parent f2e1ea7e36
commit 70129ecc07
5 changed files with 31 additions and 4 deletions

View File

@@ -72,7 +72,7 @@ public class BootstrapConfigurationTests {
}
@Test
public void pickupExternalBootstrapProperties() {
public void pickupOnlyExternalBootstrapProperties() {
String externalPropertiesPath = getExternalProperties();
this.context = new SpringApplicationBuilder().web(WebApplicationType.NONE)
@@ -81,9 +81,27 @@ public class BootstrapConfigurationTests {
.run();
then(this.context.getEnvironment().getProperty("info.name"))
.isEqualTo("externalPropertiesInfoName");
then(this.context.getEnvironment().getProperty("info.desc")).isNull();
then(this.context.getEnvironment().getPropertySources().contains(
PropertySourceBootstrapConfiguration.BOOTSTRAP_PROPERTY_SOURCE_NAME))
.isTrue();
.isTrue();
}
@Test
public void pickupAdditionalExternalBootstrapProperties() {
String externalPropertiesPath = getExternalProperties();
this.context = new SpringApplicationBuilder().web(WebApplicationType.NONE)
.sources(BareConfiguration.class)
.properties("spring.cloud.bootstrap.additional-location=" + externalPropertiesPath)
.run();
then(this.context.getEnvironment().getProperty("info.name"))
.isEqualTo("externalPropertiesInfoName");
then(this.context.getEnvironment().getProperty("info.desc"))
.isEqualTo("defaultPropertiesInfoDesc");
then(this.context.getEnvironment().getPropertySources().contains(
PropertySourceBootstrapConfiguration.BOOTSTRAP_PROPERTY_SOURCE_NAME))
.isTrue();
}
@Test
@@ -111,7 +129,7 @@ public class BootstrapConfigurationTests {
* @return
*/
private String getExternalProperties() {
String externalPropertiesPath = "classpath:bootstrap.properties,classpath:external-properties/bootstrap.properties";
String externalPropertiesPath = "classpath:external-properties/bootstrap.properties";
return externalPropertiesPath;
}