-
Notifications
You must be signed in to change notification settings - Fork 41.2k
Enable PathPattern based matching for MVC actuators #24645
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
See also #24805 |
We might be able to share the same |
I think it makes sense for us to completely switch our I wanted to make this change for 2.5.0.RC1, unfortunately I his a snag with spring-projects/spring-framework#26814. The same issue has also caused us to revert #24805. |
This change seems to have broken compatibility with the latest release of As See also here: https://stackoverflow.com/questions/69108273/spring-boot-swagger-documentation-doesnt-work/69814964 |
Spring Framework 5.3 introduced the
PathPattern
as an efficient alternative toAntPathMatcher
URL matching.Spring Boot 2.4 introduced (in issue #21694) a new config property to enable the
PathPattern
-based URL matching;spring.mvc.pathmatch.matching-strategy=path_pattern_parser
.This works well for URL matching of
@Controller
s etc, butorg.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping
does not respect the aforementioned config property - it always uses theAntPathMatcher
-based URL matching. I.e. all actuator endpoints still have their URLs matched withAntPathMatcher
. This is a bit painful since theWebMvcEndpointHandlerMapping
typically has higher priority than theRequestMappingHandlerMapping
and hence is asked to try to match every incoming request before theRequestMappingHandlerMapping
gets to do its thing. I.e. every request is still matched with theAntPathMatcher
even if we usespring.mvc.pathmatch.matching-strategy=path_pattern_parser
.I would expect the
WebMvcEndpointHandlerMapping
to respect the configuration and use thePathPattern
-based URL matching in this case so that I can completely eliminate the use ofAntPathMatcher
.The root cause of this seems to be that
WebMvcEndpointHandlerMapping
initialises itsAbstractWebMvcEndpointHandlerMapping#builderConfig
via a private static method that does not take any configuration into account.In contrast
RequestMappingHandlerMapping
(that respects the configuration property) initialisesRequestMappingHandlerMapping#config
in#afterPropertiesSet()
with the pattern parser typically injected viaorg.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration.WebMvcAutoConfigurationAdapter#configurePathMatch
.The text was updated successfully, but these errors were encountered: