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
This commit is contained in:
parent
559c178637
commit
81058cab03
|
@ -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/**/";
|
||||
|
|
Loading…
Reference in New Issue