You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently WebMvcAutoConfiguration sets a PathPatternParser if the matching-strategy is PATH_PATTERN_PARSER but doesn't do anything if it is ANT_PATH_MATCHER since AntPathMatcher is used by the default.
After the changes in spring-projects/spring-framework#28607, parsed patterns are enabled by default, in Spring Framework 6.0, and that will require a review and likely some changes in the Boot auto-configuration to ensure the properties continue to work as expected.
First, it is now necessary to explicitly enable String path matching when it is needed. This can be done either by explicitly setting PathMatchConfigurer#patternParser to null. Second, technically a PathPatternParser does not need to be set externally in order to enable parsed patterns.
Do keep in mind, however, that if any AntPathMatcher related properties on PathMatchConfigurer are set, that could enable String path matching, if a PathPatternParser is not explicitly set. Generally, an application should not set the matching-strategy to PATH_PATTERN_PARSER and at the same time set AntPathMatcher related properties, as those are mutually exclusive. If both are set, then PathPatternParser takes precedence, but if only AntPathMatcher related properties are set then String path matching is enabled.
The text was updated successfully, but these errors were encountered:
rstoyanchev
changed the title
Adapt to PathPatternParser default settings in Spring MVC
Adapt to change in default strategy for URL path matching in Spring MVC
Jun 29, 2022
Thanks for the offer, @EduColnago. Unfortunately, we don't know exactly what needs to be done here. I think we'll need to do some investigation and design work before anyone can tackle it. I'll update the labels accordingly.
Currently
WebMvcAutoConfiguration
sets aPathPatternParser
if thematching-strategy
isPATH_PATTERN_PARSER
but doesn't do anything if it isANT_PATH_MATCHER
sinceAntPathMatcher
is used by the default.After the changes in spring-projects/spring-framework#28607, parsed patterns are enabled by default, in Spring Framework 6.0, and that will require a review and likely some changes in the Boot auto-configuration to ensure the properties continue to work as expected.
First, it is now necessary to explicitly enable String path matching when it is needed. This can be done either by explicitly setting
PathMatchConfigurer#patternParser
tonull
. Second, technically aPathPatternParser
does not need to be set externally in order to enable parsed patterns.Do keep in mind, however, that if any
AntPathMatcher
related properties onPathMatchConfigurer
are set, that could enable String path matching, if aPathPatternParser
is not explicitly set. Generally, an application should not set the matching-strategy toPATH_PATTERN_PARSER
and at the same time setAntPathMatcher
related properties, as those are mutually exclusive. If both are set, thenPathPatternParser
takes precedence, but if onlyAntPathMatcher
related properties are set then String path matching is enabled.The text was updated successfully, but these errors were encountered: