Commit ab8e599c authored by Phillip Webb's avatar Phillip Webb

Switch default MVC path matching strategy

Change the default `spring.mvc.pathmatch.matching-strategy` to
`PATH_PATTERN_PARSER`.

Closes gh-24805
parent 455864bf
...@@ -434,7 +434,7 @@ public class WebMvcProperties { ...@@ -434,7 +434,7 @@ public class WebMvcProperties {
/** /**
* Choice of strategy for matching request paths against registered mappings. * Choice of strategy for matching request paths against registered mappings.
*/ */
private MatchingStrategy matchingStrategy = MatchingStrategy.ANT_PATH_MATCHER; private MatchingStrategy matchingStrategy = MatchingStrategy.PATH_PATTERN_PARSER;
/** /**
* Whether to use suffix pattern match (".*") when matching patterns to requests. * Whether to use suffix pattern match (".*") when matching patterns to requests.
......
...@@ -849,7 +849,8 @@ class WebMvcAutoConfigurationTests { ...@@ -849,7 +849,8 @@ class WebMvcAutoConfigurationTests {
@Deprecated @Deprecated
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
void useSuffixPatternMatch() { void useSuffixPatternMatch() {
this.contextRunner.withPropertyValues("spring.mvc.pathmatch.use-suffix-pattern:true", this.contextRunner.withPropertyValues("spring.mvc.pathmatch.matching-strategy=ant-path-matcher",
"spring.mvc.pathmatch.use-suffix-pattern:true",
"spring.mvc.pathmatch.use-registered-suffix-pattern:true").run((context) -> { "spring.mvc.pathmatch.use-registered-suffix-pattern:true").run((context) -> {
RequestMappingHandlerMapping handlerMapping = context.getBean(RequestMappingHandlerMapping.class); RequestMappingHandlerMapping handlerMapping = context.getBean(RequestMappingHandlerMapping.class);
assertThat(handlerMapping.useSuffixPatternMatch()).isTrue(); assertThat(handlerMapping.useSuffixPatternMatch()).isTrue();
......
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