Commit 81058cab authored by Phillip Webb's avatar Phillip Webb

Allow clash in spring.config.name

Remove the recently added slash restriction since Spring Cloud
Config Server needs to support names with slashes.

See gh-21217
parent 559c1786
......@@ -728,8 +728,6 @@ public class ConfigFileApplicationListener implements EnvironmentPostProcessor,
private void assertValidConfigName(String name) {
Assert.state(!name.contains("*"), () -> "Config name '" + name + "' cannot contain wildcards");
Assert.state(!name.contains("/") && !name.contains("\\"),
() -> "Config name '" + name + "' cannot contain slashes");
}
private void addLoadedPropertySources() {
......
......@@ -1051,6 +1051,14 @@ class ConfigFileApplicationListenerTests {
.withMessage("Config name '*/application' cannot contain wildcards");
}
@Test
void configNameCanContainSlash() {
// Spring Cloud config server depends on this
TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.environment,
"spring.config.location=file:src/test/resources/", "spring.config.name=config/application");
this.initializer.postProcessEnvironment(this.environment, this.application);
}
@Test
void directoryLocationsWithMultipleWildcardsShouldThrowException() {
String location = "file:src/test/resources/config/**/";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment