Skip to content

Commit

Permalink
Switch default MVC path matching strategy"
Browse files Browse the repository at this point in the history
Change the default `spring.mvc.pathmatch.matching-strategy` to
`PATH_PATTERN_PARSER`.

Closes gh-24805
  • Loading branch information
mbhave committed Sep 2, 2021
1 parent b01fa6a commit 2d89a82
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Expand Up @@ -401,7 +401,7 @@ public static class Pathmatch {
/**
* 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.
Expand Down
Expand Up @@ -837,7 +837,8 @@ void defaultPathMatching() {
@Test
@Deprecated
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) -> {
RequestMappingHandlerMapping handlerMapping = context.getBean(RequestMappingHandlerMapping.class);
assertThat(handlerMapping.useSuffixPatternMatch()).isTrue();
Expand Down

0 comments on commit 2d89a82

Please sign in to comment.