From 647a5ec6bebd831b68d4b2e38c3968f1ac11f400 Mon Sep 17 00:00:00 2001 From: Brian Clozel Date: Mon, 15 Apr 2024 13:43:32 +0200 Subject: [PATCH] Deprecate framework-specific @*Endpoint annotations Prior to this commit, applications could declare Actuator Endpoints using web framework-specific annotations, such as `@ServletEndpoint`, @ControllerEndpoint and @RestControllerEndpoint. Such annotations are closely tied to the programming model of specific web technologies, such as Servlet or Spring MVC. Unlike other `@Endpoint` support, they are not portable and will not work transparently over blocking/reactive and transports. Because of the strong adherence of this support with the underlying infrastructure, it makes it impossible to evolve the implementation of Actuator support without breaking this use case. The reference documentation has been advocating for using `@Endpoint` and `@*Operation` for custom endpoints for a long time now. This commit deprecates this specific support in favor of the recommended approach. Closes gh-31768 --- ...CloudFoundryActuatorAutoConfiguration.java | 3 ++- ...ndpointManagementContextConfiguration.java | 5 ++++- .../web/WebEndpointAutoConfiguration.java | 4 +++- ...ndpointManagementContextConfiguration.java | 4 +++- ...ndpointManagementContextConfiguration.java | 3 ++- ...ntManagementContextConfigurationTests.java | 1 + .../WebEndpointAutoConfigurationTests.java | 3 +++ ...rollerEndpointWebFluxIntegrationTests.java | 1 + ...trollerEndpointWebMvcIntegrationTests.java | 1 + .../JerseyEndpointIntegrationTests.java | 2 ++ .../WebFluxEndpointIntegrationTests.java | 2 ++ ...ebMvcEndpointExposureIntegrationTests.java | 2 ++ .../WebMvcEndpointIntegrationTests.java | 3 +++ .../reactive/EndpointRequestTests.java | 1 + ...stractEndpointRequestIntegrationTests.java | 1 + .../servlet/EndpointRequestTests.java | 1 + ...dContextConfigurationIntegrationTests.java | 1 + .../actuate/endpoint/web/EndpointServlet.java | 4 +++- .../web/ExposableServletEndpoint.java | 5 ++++- .../web/ServletEndpointRegistrar.java | 5 ++++- .../web/annotation/ControllerEndpoint.java | 4 +++- .../ControllerEndpointDiscoverer.java | 8 +++++--- .../annotation/ControllerEndpointFilter.java | 3 ++- .../annotation/DiscoveredServletEndpoint.java | 3 ++- .../annotation/RestControllerEndpoint.java | 4 +++- .../web/annotation/ServletEndpoint.java | 4 +++- .../annotation/ServletEndpointDiscoverer.java | 8 +++++--- .../web/annotation/ServletEndpointFilter.java | 3 ++- .../annotation/ServletEndpointsSupplier.java | 5 ++++- .../web/EndpointLinksResolverTests.java | 1 + .../endpoint/web/EndpointServletTests.java | 1 + .../web/ServletEndpointRegistrarTests.java | 1 + .../ControllerEndpointDiscovererTests.java | 5 +++-- .../ServletEndpointDiscovererTests.java | 5 +++-- ...ndpointHandlerMappingIntegrationTests.java | 1 + ...ControllerEndpointHandlerMappingTests.java | 1 + ...ndpointHandlerMappingIntegrationTests.java | 1 + ...ControllerEndpointHandlerMappingTests.java | 1 + .../antora/modules/ROOT/pages/redirect.adoc | 2 -- .../reference/pages/actuator/endpoints.adoc | 20 ------------------- .../ExampleRestControllerEndpoint.java | 1 + ...mpleActuatorCustomSecurityApplication.java | 1 + ...leRestControllerEndpointWithException.java | 1 + .../jersey/SampleSecureJerseyApplication.java | 2 ++ 44 files changed, 91 insertions(+), 47 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundryActuatorAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundryActuatorAutoConfiguration.java index 08a688c53bef..be7462376d11 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundryActuatorAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundryActuatorAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2023 the original author or authors. + * Copyright 2012-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -111,6 +111,7 @@ public CloudFoundryInfoEndpointWebExtension cloudFoundryInfoEndpointWebExtension } @Bean + @SuppressWarnings("removal") public CloudFoundryWebEndpointServletHandlerMapping cloudFoundryWebEndpointServletHandlerMapping( ParameterValueMapper parameterMapper, EndpointMediaTypes endpointMediaTypes, RestTemplateBuilder restTemplateBuilder, ServletEndpointsSupplier servletEndpointsSupplier, diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/ServletEndpointManagementContextConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/ServletEndpointManagementContextConfiguration.java index 16e6453a1c4e..2e5de5c8f4ab 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/ServletEndpointManagementContextConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/ServletEndpointManagementContextConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2022 the original author or authors. + * Copyright 2012-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,6 +47,7 @@ public class ServletEndpointManagementContextConfiguration { @Bean + @SuppressWarnings("removal") public IncludeExcludeEndpointFilter servletExposeExcludePropertyEndpointFilter( WebEndpointProperties properties) { WebEndpointProperties.Exposure exposure = properties.getExposure(); @@ -56,6 +57,7 @@ public IncludeExcludeEndpointFilter servletExposeExclu @Configuration(proxyBeanMethods = false) @ConditionalOnClass(DispatcherServlet.class) + @SuppressWarnings("removal") public static class WebMvcServletEndpointManagementContextConfiguration { @Bean @@ -70,6 +72,7 @@ public ServletEndpointRegistrar servletEndpointRegistrar(WebEndpointProperties p @Configuration(proxyBeanMethods = false) @ConditionalOnClass(ResourceConfig.class) @ConditionalOnMissingClass("org.springframework.web.servlet.DispatcherServlet") + @SuppressWarnings("removal") public static class JerseyServletEndpointManagementContextConfiguration { @Bean diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/WebEndpointAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/WebEndpointAutoConfiguration.java index 66f1c43df22f..504e6beb8f54 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/WebEndpointAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/WebEndpointAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2022 the original author or authors. + * Copyright 2012-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -96,6 +96,7 @@ public WebEndpointDiscoverer webEndpointDiscoverer(ParameterValueMapper paramete @Bean @ConditionalOnMissingBean(ControllerEndpointsSupplier.class) + @SuppressWarnings("removal") public ControllerEndpointDiscoverer controllerEndpointDiscoverer(ObjectProvider endpointPathMappers, ObjectProvider>> filters) { return new ControllerEndpointDiscoverer(this.applicationContext, endpointPathMappers.orderedStream().toList(), @@ -124,6 +125,7 @@ public IncludeExcludeEndpointFilter controllerExpos @Configuration(proxyBeanMethods = false) @ConditionalOnWebApplication(type = Type.SERVLET) + @SuppressWarnings("removal") static class WebEndpointServletConfiguration { @Bean diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/jersey/JerseyWebEndpointManagementContextConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/jersey/JerseyWebEndpointManagementContextConfiguration.java index dd7a8668ca4c..81816b231d77 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/jersey/JerseyWebEndpointManagementContextConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/jersey/JerseyWebEndpointManagementContextConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2023 the original author or authors. + * Copyright 2012-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -84,6 +84,7 @@ class JerseyWebEndpointManagementContextConfiguration { private static final EndpointId HEALTH_ENDPOINT_ID = EndpointId.of("health"); @Bean + @SuppressWarnings("removal") JerseyWebEndpointsResourcesRegistrar jerseyWebEndpointsResourcesRegistrar(Environment environment, WebEndpointsSupplier webEndpointsSupplier, ServletEndpointsSupplier servletEndpointsSupplier, EndpointMediaTypes endpointMediaTypes, WebEndpointProperties webEndpointProperties) { @@ -124,6 +125,7 @@ private boolean shouldRegisterLinksMapping(WebEndpointProperties properties, Env /** * Register endpoints with the {@link ResourceConfig} for the management context. */ + @SuppressWarnings("removal") static class JerseyWebEndpointsResourcesRegistrar implements ManagementContextResourceConfigCustomizer { private final WebEndpointsSupplier webEndpointsSupplier; 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 451e08b61396..f90dab6cfbb2 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 @@ -1,5 +1,5 @@ /* - * Copyright 2012-2023 the original author or authors. + * Copyright 2012-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -82,6 +82,7 @@ public class WebMvcEndpointManagementContextConfiguration { @Bean @ConditionalOnMissingBean + @SuppressWarnings("removal") public WebMvcEndpointHandlerMapping webEndpointServletHandlerMapping(WebEndpointsSupplier webEndpointsSupplier, ServletEndpointsSupplier servletEndpointsSupplier, ControllerEndpointsSupplier controllerEndpointsSupplier, EndpointMediaTypes endpointMediaTypes, CorsEndpointProperties corsProperties, diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/ServletEndpointManagementContextConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/ServletEndpointManagementContextConfigurationTests.java index 0df0cf10d083..80dc9f599fcf 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/ServletEndpointManagementContextConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/ServletEndpointManagementContextConfigurationTests.java @@ -42,6 +42,7 @@ * @author Phillip Webb * @author Madhura Bhave */ +@SuppressWarnings("removal") class ServletEndpointManagementContextConfigurationTests { private final WebApplicationContextRunner contextRunner = new WebApplicationContextRunner() diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/WebEndpointAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/WebEndpointAutoConfigurationTests.java index bb5833d34591..4b8fa6d54572 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/WebEndpointAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/WebEndpointAutoConfigurationTests.java @@ -95,6 +95,7 @@ void webApplicationSupportCustomPathMatcher() { } @Test + @SuppressWarnings("removal") void webApplicationConfiguresEndpointDiscoverer() { this.contextRunner.run((context) -> { assertThat(context).hasSingleBean(ControllerEndpointDiscoverer.class); @@ -109,11 +110,13 @@ void webApplicationConfiguresExposeExcludePropertyEndpointFilter() { } @Test + @SuppressWarnings("removal") void contextShouldConfigureServletEndpointDiscoverer() { this.contextRunner.run((context) -> assertThat(context).hasSingleBean(ServletEndpointDiscoverer.class)); } @Test + @SuppressWarnings("removal") void contextWhenNotServletShouldNotConfigureServletEndpointDiscoverer() { new ApplicationContextRunner().withConfiguration(CONFIGURATIONS) .run((context) -> assertThat(context).doesNotHaveBean(ServletEndpointDiscoverer.class)); diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/ControllerEndpointWebFluxIntegrationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/ControllerEndpointWebFluxIntegrationTests.java index 884d7bda461e..a0aa5b50cb5a 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/ControllerEndpointWebFluxIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/ControllerEndpointWebFluxIntegrationTests.java @@ -45,6 +45,7 @@ * * @author Phillip Webb */ +@SuppressWarnings("removal") class ControllerEndpointWebFluxIntegrationTests { private AnnotationConfigReactiveWebApplicationContext context; diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/ControllerEndpointWebMvcIntegrationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/ControllerEndpointWebMvcIntegrationTests.java index 7c9c7b8f93c2..fade67f1ae93 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/ControllerEndpointWebMvcIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/ControllerEndpointWebMvcIntegrationTests.java @@ -121,6 +121,7 @@ static class SecureConfiguration { } @RestControllerEndpoint(id = "example") + @SuppressWarnings("removal") static class ExampleController { @GetMapping("/") diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/JerseyEndpointIntegrationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/JerseyEndpointIntegrationTests.java index f027c7f21ec4..08a488fd9840 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/JerseyEndpointIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/JerseyEndpointIntegrationTests.java @@ -161,11 +161,13 @@ private Class[] getAutoconfigurations(Class... additional) { } @ControllerEndpoint(id = "controller") + @SuppressWarnings("removal") static class TestControllerEndpoint { } @RestControllerEndpoint(id = "restcontroller") + @SuppressWarnings("removal") static class TestRestControllerEndpoint { } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/WebFluxEndpointIntegrationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/WebFluxEndpointIntegrationTests.java index b0fe7468ae04..a3d8c0f17b9a 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/WebFluxEndpointIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/WebFluxEndpointIntegrationTests.java @@ -108,11 +108,13 @@ private WebTestClient createWebTestClient(ApplicationContext context) { } @ControllerEndpoint(id = "controller") + @SuppressWarnings("removal") static class TestControllerEndpoint { } @RestControllerEndpoint(id = "restcontroller") + @SuppressWarnings("removal") static class TestRestControllerEndpoint { } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/WebMvcEndpointExposureIntegrationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/WebMvcEndpointExposureIntegrationTests.java index 6fb027288cba..f7b8a3243313 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/WebMvcEndpointExposureIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/WebMvcEndpointExposureIntegrationTests.java @@ -190,6 +190,7 @@ private boolean isExposed(WebTestClient client, HttpMethod method, String path) } @RestControllerEndpoint(id = "custommvc") + @SuppressWarnings("removal") static class CustomMvcEndpoint { @GetMapping("/") @@ -200,6 +201,7 @@ String main() { } @ServletEndpoint(id = "customservlet") + @SuppressWarnings("removal") static class CustomServletEndpoint implements Supplier { @Override diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/WebMvcEndpointIntegrationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/WebMvcEndpointIntegrationTests.java index 6108345a1ccc..2d75994210f9 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/WebMvcEndpointIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/WebMvcEndpointIntegrationTests.java @@ -198,6 +198,7 @@ static class SecureConfiguration { } @ServletEndpoint(id = "servlet") + @SuppressWarnings("removal") static class TestServletEndpoint implements Supplier { @Override @@ -209,11 +210,13 @@ public EndpointServlet get() { } @ControllerEndpoint(id = "controller") + @SuppressWarnings("removal") static class TestControllerEndpoint { } @RestControllerEndpoint(id = "restcontroller") + @SuppressWarnings("removal") static class TestRestControllerEndpoint { } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/reactive/EndpointRequestTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/reactive/EndpointRequestTests.java index f29594a43394..9ba6c9d1fce5 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/reactive/EndpointRequestTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/reactive/EndpointRequestTests.java @@ -355,6 +355,7 @@ static class FooEndpoint { } @ServletEndpoint(id = "baz") + @SuppressWarnings("removal") static class BazServletEndpoint { } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/servlet/AbstractEndpointRequestIntegrationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/servlet/AbstractEndpointRequestIntegrationTests.java index 9417437d92f7..de7b8754af59 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/servlet/AbstractEndpointRequestIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/servlet/AbstractEndpointRequestIntegrationTests.java @@ -178,6 +178,7 @@ Object getAll() { } @ServletEndpoint(id = "se1") + @SuppressWarnings("removal") static class TestServletEndpoint implements Supplier { @Override diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/servlet/EndpointRequestTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/servlet/EndpointRequestTests.java index 440b484b830a..d3d5cb448b7a 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/servlet/EndpointRequestTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/servlet/EndpointRequestTests.java @@ -354,6 +354,7 @@ static class FooEndpoint { } @ServletEndpoint(id = "baz") + @SuppressWarnings("removal") static class BazServletEndpoint { } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/servlet/WebMvcEndpointChildContextConfigurationIntegrationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/servlet/WebMvcEndpointChildContextConfigurationIntegrationTests.java index ff43ecea4aa0..1699f1091dd8 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/servlet/WebMvcEndpointChildContextConfigurationIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/servlet/WebMvcEndpointChildContextConfigurationIntegrationTests.java @@ -217,6 +217,7 @@ String fail() { } @RestControllerEndpoint(id = "failController") + @SuppressWarnings("removal") static class FailingControllerEndpoint { @GetMapping diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/EndpointServlet.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/EndpointServlet.java index f7949e5fe93f..6f7b9e83ae16 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/EndpointServlet.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/EndpointServlet.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,7 +33,9 @@ * @author Phillip Webb * @author Julio José Gómez Díaz * @since 2.0.0 + * @deprecated since 3.3.0 in favor of {@code @Endpoint} and {@code @WebEndpoint} */ +@Deprecated(since = "3.3.0", forRemoval = true) public final class EndpointServlet { private final Servlet servlet; diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/ExposableServletEndpoint.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/ExposableServletEndpoint.java index bdef98a341a9..7303daac6122 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/ExposableServletEndpoint.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/ExposableServletEndpoint.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,7 +24,10 @@ * * @author Phillip Webb * @since 2.0.0 + * @deprecated since 3.3.0 in favor of {@code @Endpoint} and {@code @WebEndpoint} */ +@Deprecated(since = "3.3.0", forRemoval = true) +@SuppressWarnings("removal") public interface ExposableServletEndpoint extends ExposableEndpoint, PathMappedEndpoint { /** diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/ServletEndpointRegistrar.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/ServletEndpointRegistrar.java index a8c37b11d9d0..b7d0a9e44f5e 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/ServletEndpointRegistrar.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/ServletEndpointRegistrar.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2022 the original author or authors. + * Copyright 2012-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,7 +35,10 @@ * @author Phillip Webb * @author Madhura Bhave * @since 2.0.0 + * @deprecated since 3.3.0 in favor of {@code @Endpoint} and {@code @WebEndpoint} support */ +@Deprecated(since = "3.3.0", forRemoval = true) +@SuppressWarnings("removal") public class ServletEndpointRegistrar implements ServletContextInitializer { private static final Log logger = LogFactory.getLog(ServletEndpointRegistrar.class); diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/ControllerEndpoint.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/ControllerEndpoint.java index dee548086ef9..334cb816018e 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/ControllerEndpoint.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/ControllerEndpoint.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,12 +47,14 @@ * @since 2.0.0 * @see WebEndpoint * @see RestControllerEndpoint + * @deprecated since 3.3.0 in favor of {@code @Endpoint} and {@code @WebEndpoint} */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @Documented @Endpoint @FilteredEndpoint(ControllerEndpointFilter.class) +@Deprecated(since = "3.3.0", forRemoval = true) public @interface ControllerEndpoint { /** diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/ControllerEndpointDiscoverer.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/ControllerEndpointDiscoverer.java index e8803cc26eba..a6c9cf3a0893 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/ControllerEndpointDiscoverer.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/ControllerEndpointDiscoverer.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2023 the original author or authors. + * Copyright 2012-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,7 +31,6 @@ import org.springframework.boot.actuate.endpoint.invoke.OperationInvoker; import org.springframework.boot.actuate.endpoint.invoke.ParameterValueMapper; import org.springframework.boot.actuate.endpoint.web.PathMapper; -import org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpointDiscoverer.ControllerEndpointDiscovererRuntimeHints; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.ImportRuntimeHints; import org.springframework.core.annotation.MergedAnnotations; @@ -43,8 +42,11 @@ * * @author Phillip Webb * @since 2.0.0 + * @deprecated since 3.3.0 in favor of {@code @Endpoint} and {@code @WebEndpoint} support */ -@ImportRuntimeHints(ControllerEndpointDiscovererRuntimeHints.class) +@ImportRuntimeHints(ControllerEndpointDiscoverer.ControllerEndpointDiscovererRuntimeHints.class) +@Deprecated(since = "3.3.0", forRemoval = true) +@SuppressWarnings("removal") public class ControllerEndpointDiscoverer extends EndpointDiscoverer implements ControllerEndpointsSupplier { diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/ControllerEndpointFilter.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/ControllerEndpointFilter.java index 244865c44c2c..883f70c4093e 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/ControllerEndpointFilter.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/ControllerEndpointFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,6 +25,7 @@ * * @author Phillip Webb */ +@SuppressWarnings("removal") class ControllerEndpointFilter extends DiscovererEndpointFilter { ControllerEndpointFilter() { diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/DiscoveredServletEndpoint.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/DiscoveredServletEndpoint.java index f8418c08ca35..9a9e67aaf590 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/DiscoveredServletEndpoint.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/DiscoveredServletEndpoint.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,6 +32,7 @@ * * @author Phillip Webb */ +@SuppressWarnings("removal") class DiscoveredServletEndpoint extends AbstractDiscoveredEndpoint implements ExposableServletEndpoint { private final String rootPath; diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/RestControllerEndpoint.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/RestControllerEndpoint.java index 0aec498c5436..26dd043b0800 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/RestControllerEndpoint.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/RestControllerEndpoint.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -48,6 +48,7 @@ * @since 2.0.0 * @see WebEndpoint * @see ControllerEndpoint + * @deprecated since 3.3.0 in favor of {@code @Endpoint} and {@code @WebEndpoint} */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @@ -55,6 +56,7 @@ @Endpoint @FilteredEndpoint(ControllerEndpointFilter.class) @ResponseBody +@Deprecated(since = "3.3.0", forRemoval = true) public @interface RestControllerEndpoint { /** diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/ServletEndpoint.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/ServletEndpoint.java index 570dc552c4aa..5a2dc80e96c4 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/ServletEndpoint.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/ServletEndpoint.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,12 +40,14 @@ * * @author Phillip Webb * @since 2.0.0 + * @deprecated since 3.3.0 in favor of {@code @Endpoint} and {@code @WebEndpoint} */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @Documented @Endpoint @FilteredEndpoint(ServletEndpointFilter.class) +@Deprecated(since = "3.3.0", forRemoval = true) public @interface ServletEndpoint { /** diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/ServletEndpointDiscoverer.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/ServletEndpointDiscoverer.java index 7e9746b19a86..9d7b6606d0c9 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/ServletEndpointDiscoverer.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/ServletEndpointDiscoverer.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2022 the original author or authors. + * Copyright 2012-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,7 +32,6 @@ import org.springframework.boot.actuate.endpoint.invoke.ParameterValueMapper; import org.springframework.boot.actuate.endpoint.web.ExposableServletEndpoint; import org.springframework.boot.actuate.endpoint.web.PathMapper; -import org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpointDiscoverer.ServletEndpointDiscovererRuntimeHints; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.ImportRuntimeHints; import org.springframework.core.annotation.MergedAnnotations; @@ -43,8 +42,11 @@ * * @author Phillip Webb * @since 2.0.0 + * @deprecated since 3.3.0 in favor of {@code @Endpoint} and {@code @WebEndpoint} */ -@ImportRuntimeHints(ServletEndpointDiscovererRuntimeHints.class) +@ImportRuntimeHints(ServletEndpointDiscoverer.ServletEndpointDiscovererRuntimeHints.class) +@Deprecated(since = "3.3.0", forRemoval = true) +@SuppressWarnings("removal") public class ServletEndpointDiscoverer extends EndpointDiscoverer implements ServletEndpointsSupplier { diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/ServletEndpointFilter.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/ServletEndpointFilter.java index 0eb0b22137b7..18626ae11929 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/ServletEndpointFilter.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/ServletEndpointFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,6 +24,7 @@ * * @author Phillip Webb */ +@SuppressWarnings("removal") class ServletEndpointFilter extends DiscovererEndpointFilter { ServletEndpointFilter() { diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/ServletEndpointsSupplier.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/ServletEndpointsSupplier.java index ee56699e586e..a51b9d706a9d 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/ServletEndpointsSupplier.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/ServletEndpointsSupplier.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,8 +24,11 @@ * * @author Phillip Webb * @since 2.0.0 + * @deprecated since 3.3.0 in favor of {@code @Endpoint} and {@code @WebEndpoint} */ @FunctionalInterface +@Deprecated(since = "3.3.0", forRemoval = true) +@SuppressWarnings("removal") public interface ServletEndpointsSupplier extends EndpointsSupplier { } diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/EndpointLinksResolverTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/EndpointLinksResolverTests.java index 29a7b0038410..763da4f46a3f 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/EndpointLinksResolverTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/EndpointLinksResolverTests.java @@ -75,6 +75,7 @@ void resolvedLinksContainsALinkForEachWebEndpointOperation() { } @Test + @SuppressWarnings("removal") void resolvedLinksContainsALinkForServletEndpoint() { ExposableServletEndpoint servletEndpoint = mock(ExposableServletEndpoint.class); given(servletEndpoint.getEndpointId()).willReturn(EndpointId.of("alpha")); diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/EndpointServletTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/EndpointServletTests.java index 56a819fc51a8..3dffe90382fd 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/EndpointServletTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/EndpointServletTests.java @@ -36,6 +36,7 @@ * @author Phillip Webb * @author Stephane Nicoll */ +@SuppressWarnings("removal") class EndpointServletTests { @Test diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/ServletEndpointRegistrarTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/ServletEndpointRegistrarTests.java index c0900bef2c02..69a04d6c2503 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/ServletEndpointRegistrarTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/ServletEndpointRegistrarTests.java @@ -48,6 +48,7 @@ * @author Stephane Nicoll */ @ExtendWith(MockitoExtension.class) +@SuppressWarnings("removal") class ServletEndpointRegistrarTests { @Mock diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/annotation/ControllerEndpointDiscovererTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/annotation/ControllerEndpointDiscovererTests.java index bf29e3bde1bd..3a11a4da8a57 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/annotation/ControllerEndpointDiscovererTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/annotation/ControllerEndpointDiscovererTests.java @@ -30,7 +30,6 @@ import org.springframework.boot.actuate.endpoint.annotation.DiscoveredEndpoint; import org.springframework.boot.actuate.endpoint.annotation.Endpoint; import org.springframework.boot.actuate.endpoint.annotation.ReadOperation; -import org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpointDiscoverer.ControllerEndpointDiscovererRuntimeHints; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration; import org.springframework.boot.test.context.assertj.AssertableApplicationContext; @@ -50,6 +49,7 @@ * @author Stephane Nicoll * @author Moritz Halbritter */ +@SuppressWarnings("removal") class ControllerEndpointDiscovererTests { private final ApplicationContextRunner contextRunner = new ApplicationContextRunner(); @@ -132,7 +132,8 @@ void getEndpointWhenEndpointHasOperationsShouldThrowException() { @Test void shouldRegisterHints() { RuntimeHints runtimeHints = new RuntimeHints(); - new ControllerEndpointDiscovererRuntimeHints().registerHints(runtimeHints, getClass().getClassLoader()); + new ControllerEndpointDiscoverer.ControllerEndpointDiscovererRuntimeHints().registerHints(runtimeHints, + getClass().getClassLoader()); assertThat(RuntimeHintsPredicates.reflection() .onType(ControllerEndpointFilter.class) .withMemberCategories(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS)).accepts(runtimeHints); diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/annotation/ServletEndpointDiscovererTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/annotation/ServletEndpointDiscovererTests.java index e4d9ec56a7e0..b892a6fafb75 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/annotation/ServletEndpointDiscovererTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/annotation/ServletEndpointDiscovererTests.java @@ -38,7 +38,6 @@ import org.springframework.boot.actuate.endpoint.annotation.ReadOperation; import org.springframework.boot.actuate.endpoint.web.EndpointServlet; import org.springframework.boot.actuate.endpoint.web.ExposableServletEndpoint; -import org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpointDiscoverer.ServletEndpointDiscovererRuntimeHints; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration; import org.springframework.boot.test.context.assertj.AssertableApplicationContext; @@ -58,6 +57,7 @@ * @author Stephane Nicoll * @author Moritz Halbritter */ +@SuppressWarnings("removal") class ServletEndpointDiscovererTests { private final ApplicationContextRunner contextRunner = new ApplicationContextRunner(); @@ -135,7 +135,8 @@ void getEndpointWhenEndpointSuppliesNullShouldThrowException() { @Test void shouldRegisterHints() { RuntimeHints runtimeHints = new RuntimeHints(); - new ServletEndpointDiscovererRuntimeHints().registerHints(runtimeHints, getClass().getClassLoader()); + new ServletEndpointDiscoverer.ServletEndpointDiscovererRuntimeHints().registerHints(runtimeHints, + getClass().getClassLoader()); assertThat(RuntimeHintsPredicates.reflection() .onType(ServletEndpointFilter.class) .withMemberCategories(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS)).accepts(runtimeHints); 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 03e5a94dfac6..208971160170 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 @@ -58,6 +58,7 @@ * @author Phillip Webb * @author Stephane Nicoll */ +@SuppressWarnings("removal") 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 e307b8d1bc67..42507d0a7955 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 @@ -46,6 +46,7 @@ * @author Phillip Webb * @author Stephane Nicoll */ +@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 75b587779452..f210be2ac66e 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 @@ -57,6 +57,7 @@ * @author Phillip Webb * @author Stephane Nicoll */ +@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 9a74d68b3319..ae22464aa074 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 @@ -43,6 +43,7 @@ * @author Phillip Webb * @author Stephane Nicoll */ +@SuppressWarnings("removal") class ControllerEndpointHandlerMappingTests { private final StaticApplicationContext context = new StaticApplicationContext(); diff --git a/spring-boot-project/spring-boot-docs/src/docs/antora/modules/ROOT/pages/redirect.adoc b/spring-boot-project/spring-boot-docs/src/docs/antora/modules/ROOT/pages/redirect.adoc index 0b2de3aadc1b..0fae7a1812fb 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/antora/modules/ROOT/pages/redirect.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/antora/modules/ROOT/pages/redirect.adoc @@ -726,10 +726,8 @@ * xref:reference:actuator/endpoints.adoc#actuator.endpoints.health.writing-custom-health-indicators[#actuator.endpoints.health.writing-custom-health-indicators] * xref:reference:actuator/endpoints.adoc#actuator.endpoints.hypermedia[#actuator.endpoints.hypermedia] * xref:reference:actuator/endpoints.adoc#actuator.endpoints.implementing-custom[#actuator.endpoints.implementing-custom] -* xref:reference:actuator/endpoints.adoc#actuator.endpoints.implementing-custom.controller[#actuator.endpoints.implementing-custom.controller] * xref:reference:actuator/endpoints.adoc#actuator.endpoints.implementing-custom.input[#actuator.endpoints.implementing-custom.input] * xref:reference:actuator/endpoints.adoc#actuator.endpoints.implementing-custom.input.conversion[#actuator.endpoints.implementing-custom.input.conversion] -* xref:reference:actuator/endpoints.adoc#actuator.endpoints.implementing-custom.servlet[#actuator.endpoints.implementing-custom.servlet] * xref:reference:actuator/endpoints.adoc#actuator.endpoints.implementing-custom.web[#actuator.endpoints.implementing-custom.web] * xref:reference:actuator/endpoints.adoc#actuator.endpoints.implementing-custom.web.consumes-predicates[#actuator.endpoints.implementing-custom.web.consumes-predicates] * xref:reference:actuator/endpoints.adoc#actuator.endpoints.implementing-custom.web.method-predicates[#actuator.endpoints.implementing-custom.web.method-predicates] diff --git a/spring-boot-project/spring-boot-docs/src/docs/antora/modules/reference/pages/actuator/endpoints.adoc b/spring-boot-project/spring-boot-docs/src/docs/antora/modules/reference/pages/actuator/endpoints.adoc index 0c245196d41a..95fd661e566d 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/antora/modules/reference/pages/actuator/endpoints.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/antora/modules/reference/pages/actuator/endpoints.adoc @@ -536,26 +536,6 @@ The latter is typically used to perform authorization checks by using its `isUse -[[actuator.endpoints.implementing-custom.servlet]] -=== Servlet Endpoints - -A servlet can be exposed as an endpoint by implementing a class annotated with `@ServletEndpoint` that also implements `Supplier`. -Servlet endpoints provide deeper integration with the servlet container but at the expense of portability. -They are intended to be used to expose an existing servlet as an endpoint. -For new endpoints, the `@Endpoint` and `@WebEndpoint` annotations should be preferred whenever possible. - - - -[[actuator.endpoints.implementing-custom.controller]] -=== Controller Endpoints - -You can use `@ControllerEndpoint` and `@RestControllerEndpoint` to implement an endpoint that is exposed only by Spring MVC or Spring WebFlux. -Methods are mapped by using the standard annotations for Spring MVC and Spring WebFlux, such as `@RequestMapping` and `@GetMapping`, with the endpoint's ID being used as a prefix for the path. -Controller endpoints provide deeper integration with Spring's web frameworks but at the expense of portability. -The `@Endpoint` and `@WebEndpoint` annotations should be preferred whenever possible. - - - [[actuator.endpoints.health]] == Health Information diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-actuator-custom-security/src/main/java/smoketest/actuator/customsecurity/ExampleRestControllerEndpoint.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-actuator-custom-security/src/main/java/smoketest/actuator/customsecurity/ExampleRestControllerEndpoint.java index 6fb650c2027d..3dcabcd6f97b 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-actuator-custom-security/src/main/java/smoketest/actuator/customsecurity/ExampleRestControllerEndpoint.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-actuator-custom-security/src/main/java/smoketest/actuator/customsecurity/ExampleRestControllerEndpoint.java @@ -24,6 +24,7 @@ @Component @RestControllerEndpoint(id = "example") +@SuppressWarnings("removal") public class ExampleRestControllerEndpoint { @GetMapping("/echo") diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-actuator-custom-security/src/main/java/smoketest/actuator/customsecurity/SampleActuatorCustomSecurityApplication.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-actuator-custom-security/src/main/java/smoketest/actuator/customsecurity/SampleActuatorCustomSecurityApplication.java index a7dd8347f383..f657b1272db7 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-actuator-custom-security/src/main/java/smoketest/actuator/customsecurity/SampleActuatorCustomSecurityApplication.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-actuator-custom-security/src/main/java/smoketest/actuator/customsecurity/SampleActuatorCustomSecurityApplication.java @@ -31,6 +31,7 @@ import org.springframework.context.annotation.Bean; @SpringBootApplication +@SuppressWarnings("removal") public class SampleActuatorCustomSecurityApplication { public static void main(String[] args) { diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-actuator/src/main/java/smoketest/actuator/SampleRestControllerEndpointWithException.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-actuator/src/main/java/smoketest/actuator/SampleRestControllerEndpointWithException.java index 26207123f151..7592268f6333 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-actuator/src/main/java/smoketest/actuator/SampleRestControllerEndpointWithException.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-actuator/src/main/java/smoketest/actuator/SampleRestControllerEndpointWithException.java @@ -31,6 +31,7 @@ */ @Component @RestControllerEndpoint(id = "exception") +@SuppressWarnings("removal") public class SampleRestControllerEndpointWithException { @GetMapping("/") diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-secure-jersey/src/main/java/smoketest/secure/jersey/SampleSecureJerseyApplication.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-secure-jersey/src/main/java/smoketest/secure/jersey/SampleSecureJerseyApplication.java index dd49b7c06666..294c419b053b 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-secure-jersey/src/main/java/smoketest/secure/jersey/SampleSecureJerseyApplication.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-secure-jersey/src/main/java/smoketest/secure/jersey/SampleSecureJerseyApplication.java @@ -31,6 +31,7 @@ import org.springframework.context.annotation.Bean; @SpringBootApplication +@SuppressWarnings("removal") public class SampleSecureJerseyApplication { public static void main(String[] args) { @@ -43,6 +44,7 @@ TestServletEndpoint servletEndpoint() { } @ServletEndpoint(id = "se1") + @SuppressWarnings("removal") static class TestServletEndpoint implements Supplier { @Override