From 93e5b3a0ffdff96837ce145c5fd73ee446d28d6f Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 2 Oct 2024 13:46:57 +0100 Subject: [PATCH] Deprecate ControllerEndpointHandlerMapping for MVC and WebFlux Closes gh-42498 --- .../WebFluxEndpointManagementContextConfiguration.java | 8 ++++---- .../WebMvcEndpointManagementContextConfiguration.java | 8 ++++---- .../web/reactive/ControllerEndpointHandlerMapping.java | 2 ++ .../web/servlet/ControllerEndpointHandlerMapping.java | 2 ++ .../ControllerEndpointHandlerMappingIntegrationTests.java | 4 +++- .../reactive/ControllerEndpointHandlerMappingTests.java | 4 +++- .../ControllerEndpointHandlerMappingIntegrationTests.java | 4 +++- .../servlet/ControllerEndpointHandlerMappingTests.java | 4 +++- 8 files changed, 24 insertions(+), 12 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/reactive/WebFluxEndpointManagementContextConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/reactive/WebFluxEndpointManagementContextConfiguration.java index 1ba83a7a9b07..d5c3da994bcd 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/reactive/WebFluxEndpointManagementContextConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/reactive/WebFluxEndpointManagementContextConfiguration.java @@ -47,7 +47,6 @@ import org.springframework.boot.actuate.endpoint.web.WebEndpointsSupplier; import org.springframework.boot.actuate.endpoint.web.WebServerNamespace; import org.springframework.boot.actuate.endpoint.web.reactive.AdditionalHealthEndpointPathsWebFluxHandlerMapping; -import org.springframework.boot.actuate.endpoint.web.reactive.ControllerEndpointHandlerMapping; import org.springframework.boot.actuate.endpoint.web.reactive.WebFluxEndpointHandlerMapping; import org.springframework.boot.actuate.health.HealthEndpoint; import org.springframework.boot.actuate.health.HealthEndpointGroups; @@ -129,12 +128,13 @@ public AdditionalHealthEndpointPathsWebFluxHandlerMapping managementHealthEndpoi @Bean @ConditionalOnMissingBean @SuppressWarnings("removal") - public ControllerEndpointHandlerMapping controllerEndpointHandlerMapping( + @Deprecated(since = "3.3.5", forRemoval = true) + public org.springframework.boot.actuate.endpoint.web.reactive.ControllerEndpointHandlerMapping controllerEndpointHandlerMapping( org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpointsSupplier controllerEndpointsSupplier, CorsEndpointProperties corsProperties, WebEndpointProperties webEndpointProperties) { EndpointMapping endpointMapping = new EndpointMapping(webEndpointProperties.getBasePath()); - return new ControllerEndpointHandlerMapping(endpointMapping, controllerEndpointsSupplier.getEndpoints(), - corsProperties.toCorsConfiguration()); + return new org.springframework.boot.actuate.endpoint.web.reactive.ControllerEndpointHandlerMapping( + endpointMapping, controllerEndpointsSupplier.getEndpoints(), corsProperties.toCorsConfiguration()); } @Bean diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/servlet/WebMvcEndpointManagementContextConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/servlet/WebMvcEndpointManagementContextConfiguration.java index ada988dd31c2..2650048e7c90 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/servlet/WebMvcEndpointManagementContextConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/servlet/WebMvcEndpointManagementContextConfiguration.java @@ -43,7 +43,6 @@ import org.springframework.boot.actuate.endpoint.web.WebEndpointsSupplier; import org.springframework.boot.actuate.endpoint.web.WebServerNamespace; import org.springframework.boot.actuate.endpoint.web.servlet.AdditionalHealthEndpointPathsWebMvcHandlerMapping; -import org.springframework.boot.actuate.endpoint.web.servlet.ControllerEndpointHandlerMapping; import org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping; import org.springframework.boot.actuate.health.HealthEndpoint; import org.springframework.boot.actuate.health.HealthEndpointGroups; @@ -124,12 +123,13 @@ public AdditionalHealthEndpointPathsWebMvcHandlerMapping managementHealthEndpoin @Bean @ConditionalOnMissingBean @SuppressWarnings("removal") - public ControllerEndpointHandlerMapping controllerEndpointHandlerMapping( + @Deprecated(since = "3.3.5", forRemoval = true) + public org.springframework.boot.actuate.endpoint.web.servlet.ControllerEndpointHandlerMapping controllerEndpointHandlerMapping( org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpointsSupplier controllerEndpointsSupplier, CorsEndpointProperties corsProperties, WebEndpointProperties webEndpointProperties) { EndpointMapping endpointMapping = new EndpointMapping(webEndpointProperties.getBasePath()); - return new ControllerEndpointHandlerMapping(endpointMapping, controllerEndpointsSupplier.getEndpoints(), - corsProperties.toCorsConfiguration()); + return new org.springframework.boot.actuate.endpoint.web.servlet.ControllerEndpointHandlerMapping( + endpointMapping, controllerEndpointsSupplier.getEndpoints(), corsProperties.toCorsConfiguration()); } @Bean diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/reactive/ControllerEndpointHandlerMapping.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/reactive/ControllerEndpointHandlerMapping.java index 834bc98301b7..e36021c59fd7 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/reactive/ControllerEndpointHandlerMapping.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/reactive/ControllerEndpointHandlerMapping.java @@ -41,7 +41,9 @@ * * @author Phillip Webb * @since 2.0.0 + * @deprecated since 3.3.5 in favor of {@code @Endpoint} and {@code @WebEndpoint} support */ +@Deprecated(since = "3.3.5", forRemoval = true) @SuppressWarnings("removal") public class ControllerEndpointHandlerMapping extends RequestMappingHandlerMapping { 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 4921fccce1a8..c6bc83611b8f 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 @@ -42,7 +42,9 @@ * * @author Phillip Webb * @since 2.0.0 + * @deprecated since 3.3.5 in favor of {@code @Endpoint} and {@code @WebEndpoint} support */ +@Deprecated(since = "3.3.5", forRemoval = true) @SuppressWarnings("removal") public class ControllerEndpointHandlerMapping extends RequestMappingHandlerMapping { diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/reactive/ControllerEndpointHandlerMappingIntegrationTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/reactive/ControllerEndpointHandlerMappingIntegrationTests.java index f48587d71846..b140a0997154 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/reactive/ControllerEndpointHandlerMappingIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/reactive/ControllerEndpointHandlerMappingIntegrationTests.java @@ -57,8 +57,10 @@ * * @author Phillip Webb * @author Stephane Nicoll + * @deprecated since 3.3.5 in favor of {@code @Endpoint} and {@code @WebEndpoint} support */ -@SuppressWarnings({ "deprecation", "removal" }) +@SuppressWarnings("removal") +@Deprecated(since = "3.3.5", forRemoval = true) class ControllerEndpointHandlerMappingIntegrationTests { private final ReactiveWebApplicationContextRunner contextRunner = new ReactiveWebApplicationContextRunner( diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/reactive/ControllerEndpointHandlerMappingTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/reactive/ControllerEndpointHandlerMappingTests.java index 6ee8f382544b..ad1e91d5a04d 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/reactive/ControllerEndpointHandlerMappingTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/reactive/ControllerEndpointHandlerMappingTests.java @@ -45,8 +45,10 @@ * * @author Phillip Webb * @author Stephane Nicoll + * @deprecated since 3.3.5 in favor of {@code @Endpoint} and {@code @WebEndpoint} support */ -@SuppressWarnings({ "deprecation", "removal" }) +@Deprecated(since = "3.3.5", forRemoval = true) +@SuppressWarnings("removal") class ControllerEndpointHandlerMappingTests { private final StaticApplicationContext context = new StaticApplicationContext(); diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/servlet/ControllerEndpointHandlerMappingIntegrationTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/servlet/ControllerEndpointHandlerMappingIntegrationTests.java index 6741c77d047d..48d674573ad4 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/servlet/ControllerEndpointHandlerMappingIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/servlet/ControllerEndpointHandlerMappingIntegrationTests.java @@ -56,8 +56,10 @@ * * @author Phillip Webb * @author Stephane Nicoll + * @deprecated since 3.3.5 in favor of {@code @Endpoint} and {@code @WebEndpoint} support */ -@SuppressWarnings({ "deprecation", "removal" }) +@Deprecated(since = "3.3.5", forRemoval = true) +@SuppressWarnings("removal") class ControllerEndpointHandlerMappingIntegrationTests { private final WebApplicationContextRunner contextRunner = new WebApplicationContextRunner( diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/servlet/ControllerEndpointHandlerMappingTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/servlet/ControllerEndpointHandlerMappingTests.java index 6296c257678e..8460fa0e2dbf 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/servlet/ControllerEndpointHandlerMappingTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/servlet/ControllerEndpointHandlerMappingTests.java @@ -42,8 +42,10 @@ * * @author Phillip Webb * @author Stephane Nicoll + * @deprecated since 3.3.5 in favor of {@code @Endpoint} and {@code @WebEndpoint} support */ -@SuppressWarnings({ "deprecation", "removal" }) +@Deprecated(since = "3.3.5", forRemoval = true) +@SuppressWarnings("removal") class ControllerEndpointHandlerMappingTests { private final StaticApplicationContext context = new StaticApplicationContext();