-
Notifications
You must be signed in to change notification settings - Fork 38.5k
Use PathPatternParser by default in Spring MVC #28607
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I think we should do this (including the deprecation) for 6.0. |
Team decision: we'll go ahead with it and align with the default in Boot. |
MockHttpServletRequest now checks the requestURI and servletPath to check whether they imply a Servlet path mapping, which is the case when the requestURI is longer than the contextPath + servletPath. This is essential when parsed patterns are in use in which case the request path is parsed taking into account only the requestURI and the contextPath. However, if the MappingMatch indicates a match by Servlet path, then the servletPath is also taken into account. See gh-28607
Parsed patterns are now enabled by default in Spring MVC. This means, each To minimize unnecessary breakage where intentions are clear, String path matching is still enabled through the MVC config, when either of the following is true:
Further steps have also been taken to minimize failures in existing tests. For example the URL path is parsed per handler lookup if not called by the |
Given the availability of two alternatives mechanisms for URL path matching, PathPatternParser and AntPathMatcher, and now that parsed patterns are enabled by default, it makes sense to reduce the proliferation of options on AbstractHandlerMapping by deprecating shortcuts related to String path matching. Most applications rely on Boot and on the MVC config to do all this. See gh-28607
PathPatternParser
was introduced for WebFlux in 5.0 as a replacement forAntPathMatcher
that uses pre-compiled patterns, supports mapping without decoding the full URL path, and optimizes the pattern syntax for web (vs file system) paths.It has been available for use in Spring MVC since version 5.3 and has been enabled as the default in Spring Boot since version 2.6 with spring-projects/spring-boot#24805.
This issue is to consider switching the default in Spring Framework to
PathPatternParser
for 6.0, and potentially deprecatePathMatcher
and related options.The text was updated successfully, but these errors were encountered: