Skip to content

Commit 2d89a82

Browse files
committed
Switch default MVC path matching strategy"
Change the default `spring.mvc.pathmatch.matching-strategy` to `PATH_PATTERN_PARSER`. Closes gh-24805
1 parent b01fa6a commit 2d89a82

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcProperties.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ public static class Pathmatch {
401401
/**
402402
* Choice of strategy for matching request paths against registered mappings.
403403
*/
404-
private MatchingStrategy matchingStrategy = MatchingStrategy.ANT_PATH_MATCHER;
404+
private MatchingStrategy matchingStrategy = MatchingStrategy.PATH_PATTERN_PARSER;
405405

406406
/**
407407
* Whether to use suffix pattern match (".*") when matching patterns to requests.

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfigurationTests.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,8 @@ void defaultPathMatching() {
837837
@Test
838838
@Deprecated
839839
void useSuffixPatternMatch() {
840-
this.contextRunner.withPropertyValues("spring.mvc.pathmatch.use-suffix-pattern:true",
840+
this.contextRunner.withPropertyValues("spring.mvc.pathmatch.matching-strategy=ant-path-matcher",
841+
"spring.mvc.pathmatch.use-suffix-pattern:true",
841842
"spring.mvc.pathmatch.use-registered-suffix-pattern:true").run((context) -> {
842843
RequestMappingHandlerMapping handlerMapping = context.getBean(RequestMappingHandlerMapping.class);
843844
assertThat(handlerMapping.useSuffixPatternMatch()).isTrue();

0 commit comments

Comments
 (0)