Skip to content

Commit 89213c7

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 b0ee15e commit 89213c7

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ public static class Pathmatch {
434434
/**
435435
* Choice of strategy for matching request paths against registered mappings.
436436
*/
437-
private MatchingStrategy matchingStrategy = MatchingStrategy.ANT_PATH_MATCHER;
437+
private MatchingStrategy matchingStrategy = MatchingStrategy.PATH_PATTERN_PARSER;
438438

439439
/**
440440
* 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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,8 @@ void defaultPathMatching() {
849849
@Deprecated
850850
@SuppressWarnings("deprecation")
851851
void useSuffixPatternMatch() {
852-
this.contextRunner.withPropertyValues("spring.mvc.pathmatch.use-suffix-pattern:true",
852+
this.contextRunner.withPropertyValues("spring.mvc.pathmatch.matching-strategy=ant-path-matcher",
853+
"spring.mvc.pathmatch.use-suffix-pattern:true",
853854
"spring.mvc.pathmatch.use-registered-suffix-pattern:true").run((context) -> {
854855
RequestMappingHandlerMapping handlerMapping = context.getBean(RequestMappingHandlerMapping.class);
855856
assertThat(handlerMapping.useSuffixPatternMatch()).isTrue();

0 commit comments

Comments
 (0)