diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/servlet/ControllerEndpointHandlerMapping.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/servlet/ControllerEndpointHandlerMapping.java index 45b226e5b9..fffa49cea8 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/servlet/ControllerEndpointHandlerMapping.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/servlet/ControllerEndpointHandlerMapping.java @@ -33,6 +33,7 @@ import org.springframework.web.cors.CorsConfiguration; import org.springframework.web.servlet.HandlerMapping; import org.springframework.web.servlet.mvc.method.RequestMappingInfo; import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; +import org.springframework.web.util.pattern.PathPattern; /** * {@link HandlerMapping} that exposes {@link ControllerEndpoint @ControllerEndpoint} and @@ -89,16 +90,16 @@ public class ControllerEndpointHandlerMapping extends RequestMappingHandlerMappi private RequestMappingInfo withEndpointMappedPatterns(ExposableControllerEndpoint endpoint, RequestMappingInfo mapping) { - Set patterns = mapping.getPatternsCondition().getPatterns(); + Set patterns = mapping.getPathPatternsCondition().getPatterns(); if (patterns.isEmpty()) { - patterns = Collections.singleton(""); + patterns = Collections.singleton(getPatternParser().parse("")); } String[] endpointMappedPatterns = patterns.stream() .map((pattern) -> getEndpointMappedPattern(endpoint, pattern)).toArray(String[]::new); return mapping.mutate().paths(endpointMappedPatterns).build(); } - private String getEndpointMappedPattern(ExposableControllerEndpoint endpoint, String pattern) { + private String getEndpointMappedPattern(ExposableControllerEndpoint endpoint, PathPattern pattern) { return this.endpointMapping.createSubPath(endpoint.getRootPath() + pattern); }