diff --git a/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/environment/NativeEnvironmentRepository.java b/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/environment/NativeEnvironmentRepository.java index 467c7fd7..6961f784 100644 --- a/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/environment/NativeEnvironmentRepository.java +++ b/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/environment/NativeEnvironmentRepository.java @@ -231,6 +231,7 @@ public class NativeEnvironmentRepository implements EnvironmentRepository, Searc } // TODO: needed anymore? name = name.replace("applicationConfig: [", ""); + name = name.replace("file [", ""); name = name.replace("]", ""); if (this.searchLocations != null) { boolean matches = false; diff --git a/spring-cloud-config-server/src/test/java/org/springframework/cloud/config/server/environment/NativeEnvironmentRepositoryTests.java b/spring-cloud-config-server/src/test/java/org/springframework/cloud/config/server/environment/NativeEnvironmentRepositoryTests.java index 395d7c72..9e37f3a9 100644 --- a/spring-cloud-config-server/src/test/java/org/springframework/cloud/config/server/environment/NativeEnvironmentRepositoryTests.java +++ b/spring-cloud-config-server/src/test/java/org/springframework/cloud/config/server/environment/NativeEnvironmentRepositoryTests.java @@ -16,6 +16,7 @@ package org.springframework.cloud.config.server.environment; +import java.util.Collections; import java.util.regex.Matcher; import org.junit.Before; @@ -25,6 +26,7 @@ import org.junit.Test; import org.springframework.boot.WebApplicationType; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.cloud.config.environment.Environment; +import org.springframework.cloud.config.environment.PropertySource; import org.springframework.cloud.config.server.environment.SearchPathLocator.Locations; import org.springframework.context.ConfigurableApplicationContext; @@ -90,6 +92,16 @@ public class NativeEnvironmentRepositoryTests { assertThat(environment.getVersion()).as("version was wrong").isEqualTo("myversion"); } + @Test + public void cleanBoot24() { + Environment environment = new Environment("application"); + environment.add(new PropertySource( + "Config resource 'file [/tmp/config-repo-7780026223759117699/application-dev.yml]' via location 'file:/tmp/config-repo-7780026223759117699/'", + Collections.singletonMap("foo", "bar"))); + assertThat(environment.getPropertySources().size()).isEqualTo(1); + assertThat(environment.getPropertySources().get(0).getName().contains("application-dev.yml")); + } + @Test @Ignore // FIXME: configdata public void labelled() {