Prior to this commit, the MVC namespace for the XML Spring configuration model would use the `PathMatcher` bean instance when provided like this: ``` <bean id="pathMatcher" class="org.springframework.util.AntPathMatcher"/> <mvc:annotation-driven> <mvc:path-matching path-matcher="pathMatcher"/> </mvc:annotation-driven> <mvc:resources mapping="/resources/**" location="classpath:/static/"/> ``` With this configuration, the handler mapping for annotated controller would use the given `AntPathMatcher` instance but the handler mapping for resources would still use the default, which is `PathPatternParser` since 6.0. This commit ensures that when a custom `path-matcher` is defined, it's consistently used for all MVC handler mappings as an alias to the well-known bean name. This allows to use `AntPathMatcher` consistently while working on a migration path to `PathPatternParser` This commit also adds a new XML attribute to the path matching configuration that makes it possible to use a custom `PathPatternParser` instance: ``` <bean id="patternParser" class="org.springframework.web.util.pattern.PathPatternParser"/> <mvc:annotation-driven> <mvc:path-matching pattern-parser="patternParser"/> </mvc:annotation-driven> ``` Closes gh-34064 |
||
---|---|---|
.. | ||
src | ||
spring-webmvc.gradle |