Merge branch '3.1.x'
This commit is contained in:
@@ -225,7 +225,7 @@ public class NativeEnvironmentRepository implements EnvironmentRepository, Searc
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("spring.profiles.active", profile);
|
||||
String config = application;
|
||||
if (!config.startsWith("application")) {
|
||||
if (!config.equals("application")) {
|
||||
config = "application," + config;
|
||||
}
|
||||
map.put("spring.config.name", config);
|
||||
|
||||
@@ -193,6 +193,15 @@ public class NativeEnvironmentRepositoryTests {
|
||||
assertThat(environment.getPropertySources().get(0).getSource().get("foo")).isEqualTo("app");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void placeholdersApplicationWithPrefixAndProfile() {
|
||||
this.repository.setSearchLocations("classpath:/test/{profile}/{application}/");
|
||||
// gh-2259 application name starts with "application"
|
||||
Environment environment = this.repository.findOne("applicationxyz", "dev", "master");
|
||||
assertThat(environment.getPropertySources().size()).isEqualTo(1);
|
||||
assertThat(environment.getPropertySources().get(0).getSource().get("foo")).isEqualTo("default-app");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void locationPlaceholdersApplication() {
|
||||
this.repository.setSearchLocations("classpath:/test/{application}");
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
foo:default-app
|
||||
Reference in New Issue
Block a user