When we create WebMvcEndpointHandlerMapping we use the path pattern parser from the MVC auto-configuration:
https://github.com/spring-projects/spring-boot/blob/17bdc526f6af27478f45a828017e28c402c04e95/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/servlet/WebMvcEndpointManagementContextConfiguration.java#L86-L88
However, when we create ControllerEndpointHandlerMapping, we don't pass in a path pattern parser:
https://github.com/spring-projects/spring-boot/blob/17bdc526f6af27478f45a828017e28c402c04e95/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/servlet/WebMvcEndpointManagementContextConfiguration.java#L116-L117
As a result, the default Ant-based path matching will be used. This feels inconsistent. However, there's a risk that changing it will break users controller and rest controller endpoints if they have implementations that rely on some capabilities of the Ant-based matching that the path pattern parser doesn't support. We may decide that we can't do anything about this until 3.0.
Comment From: ailjushkin
@wilkinsona After upgrading from SB 2.3 to 2.7 I also faced a problem with the config you wrote :)
Parameter 0 of method psTraceFilterRegistration in com.peterservice.bssbox.common.oapi.autoconfigure.PSTraceFilterAutoConfiguration required a single bean, but 2 were found:
- requestMappingHandlerMapping: defined by method 'requestMappingHandlerMapping' in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]
- controllerEndpointHandlerMapping: defined by method 'controllerEndpointHandlerMapping' in class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/web/servlet/WebMvcEndpointManagementContextConfiguration.class]
Whan options do I have to fix that?
I'm not sure I can modify that library that owns PSTraceFilterAutoConfiguration
Comment From: wilkinsona
That doesn't appear to be related to this issue which is specifically about request matching, not handler mapping beans. Please follow up on Stack Overflow or Gitter, but I think you'll have to try to change PSTraceFilterAutoConfiguration. You cannot assume that there will only be a single RequestMappingHandlerMapping bean in the context. Spring MVC supports any number of them.
Comment From: mbhave
As of Spring Framework 6.0, this is the default so there isn't any change for boot to make here. This can be verified by pathPatternsCondition not being null. Closing the issue as superseded.
Comment From: vpavic
It's a bit unclear what has this been superseded by. Is it #31700 or something else?
Comment From: wilkinsona
It's #31700.