Allow 'servet.path' with path pattern parser

Remove the restriction previously prevented `spring.mvc.servlet.path`
from being combined with a `spring.mvc.pathmatch.matching-strategy`
of `PATH_PATTERN_PARSER`. Spring Framework supports this combination
as of v5.3.4.

See gh-24805
pull/25943/head
Phillip Webb 4 years ago
parent 4d510d3c9b
commit 455864bfa0

@ -251,10 +251,6 @@ public class WebMvcProperties {
throw new IncompatibleConfigurationException("spring.mvc.pathmatch.matching-strategy",
"spring.mvc.pathmatch.use-registered-suffix-pattern");
}
if (!this.getServlet().getServletMapping().equals("/")) {
throw new IncompatibleConfigurationException("spring.mvc.pathmatch.matching-strategy",
"spring.mvc.servlet.path");
}
}
}

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -80,14 +80,6 @@ class WebMvcPropertiesTests {
.isThrownBy(this.properties::checkConfiguration);
}
@Test
void incompatiblePathMatchServletPathConfig() {
this.properties.getPathmatch().setMatchingStrategy(WebMvcProperties.MatchingStrategy.PATH_PATTERN_PARSER);
this.properties.getServlet().setPath("/test");
assertThatExceptionOfType(IncompatibleConfigurationException.class)
.isThrownBy(this.properties::checkConfiguration);
}
private void bind(String name, String value) {
bind(Collections.singletonMap(name, value));
}

Loading…
Cancel
Save