Skip to content

Commit d47cb4a

Browse files
committed
Merge pull request #41596 from cms04
* gh-41596: Polish "Deprecate ControllerEndpointsSupplier and ExposableControllerEndpoint" Deprecate ControllerEndpointsSupplier and ExposableControllerEndpoint Closes gh-41596
2 parents fd58261 + 4c9013f commit d47cb4a

File tree

13 files changed

+41
-30
lines changed

13 files changed

+41
-30
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveCloudFoundryActuatorAutoConfiguration.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -37,7 +37,6 @@
3737
import org.springframework.boot.actuate.endpoint.web.EndpointMediaTypes;
3838
import org.springframework.boot.actuate.endpoint.web.ExposableWebEndpoint;
3939
import org.springframework.boot.actuate.endpoint.web.PathMappedEndpoints;
40-
import org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpointsSupplier;
4140
import org.springframework.boot.actuate.health.HealthEndpoint;
4241
import org.springframework.boot.actuate.health.ReactiveHealthEndpointWebExtension;
4342
import org.springframework.boot.actuate.info.GitInfoContributor;
@@ -107,9 +106,11 @@ public CloudFoundryInfoEndpointWebExtension cloudFoundryInfoEndpointWebExtension
107106
}
108107

109108
@Bean
109+
@SuppressWarnings("removal")
110110
public CloudFoundryWebFluxEndpointHandlerMapping cloudFoundryWebFluxEndpointHandlerMapping(
111111
ParameterValueMapper parameterMapper, EndpointMediaTypes endpointMediaTypes,
112-
WebClient.Builder webClientBuilder, ControllerEndpointsSupplier controllerEndpointsSupplier,
112+
WebClient.Builder webClientBuilder,
113+
org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpointsSupplier controllerEndpointsSupplier,
113114
ApplicationContext applicationContext) {
114115
CloudFoundryWebEndpointDiscoverer endpointDiscoverer = new CloudFoundryWebEndpointDiscoverer(applicationContext,
115116
parameterMapper, endpointMediaTypes, null, Collections.emptyList(), Collections.emptyList());

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundryActuatorAutoConfiguration.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
import org.springframework.boot.actuate.endpoint.web.EndpointMediaTypes;
3535
import org.springframework.boot.actuate.endpoint.web.ExposableWebEndpoint;
3636
import org.springframework.boot.actuate.endpoint.web.PathMappedEndpoints;
37-
import org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpointsSupplier;
3837
import org.springframework.boot.actuate.health.HealthEndpoint;
3938
import org.springframework.boot.actuate.health.HealthEndpointWebExtension;
4039
import org.springframework.boot.actuate.info.GitInfoContributor;
@@ -115,7 +114,8 @@ public CloudFoundryWebEndpointServletHandlerMapping cloudFoundryWebEndpointServl
115114
ParameterValueMapper parameterMapper, EndpointMediaTypes endpointMediaTypes,
116115
RestTemplateBuilder restTemplateBuilder,
117116
org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpointsSupplier servletEndpointsSupplier,
118-
ControllerEndpointsSupplier controllerEndpointsSupplier, ApplicationContext applicationContext) {
117+
org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpointsSupplier controllerEndpointsSupplier,
118+
ApplicationContext applicationContext) {
119119
CloudFoundryWebEndpointDiscoverer discoverer = new CloudFoundryWebEndpointDiscoverer(applicationContext,
120120
parameterMapper, endpointMediaTypes, null, Collections.emptyList(), Collections.emptyList());
121121
CloudFoundrySecurityInterceptor securityInterceptor = getSecurityInterceptor(restTemplateBuilder,

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/WebEndpointAutoConfiguration.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@
3333
import org.springframework.boot.actuate.endpoint.web.PathMappedEndpoints;
3434
import org.springframework.boot.actuate.endpoint.web.PathMapper;
3535
import org.springframework.boot.actuate.endpoint.web.WebEndpointsSupplier;
36-
import org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpointsSupplier;
37-
import org.springframework.boot.actuate.endpoint.web.annotation.ExposableControllerEndpoint;
3836
import org.springframework.boot.actuate.endpoint.web.annotation.WebEndpointDiscoverer;
3937
import org.springframework.boot.autoconfigure.AutoConfiguration;
4038
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@@ -91,11 +89,11 @@ public WebEndpointDiscoverer webEndpointDiscoverer(ParameterValueMapper paramete
9189
}
9290

9391
@Bean
94-
@ConditionalOnMissingBean(ControllerEndpointsSupplier.class)
92+
@ConditionalOnMissingBean(org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpointsSupplier.class)
9593
@SuppressWarnings({ "deprecation", "removal" })
9694
public org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpointDiscoverer controllerEndpointDiscoverer(
9795
ObjectProvider<PathMapper> endpointPathMappers,
98-
ObjectProvider<Collection<EndpointFilter<ExposableControllerEndpoint>>> filters) {
96+
ObjectProvider<Collection<EndpointFilter<org.springframework.boot.actuate.endpoint.web.annotation.ExposableControllerEndpoint>>> filters) {
9997
return new org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpointDiscoverer(
10098
this.applicationContext, endpointPathMappers.orderedStream().toList(),
10199
filters.getIfAvailable(Collections::emptyList));
@@ -115,10 +113,12 @@ public IncludeExcludeEndpointFilter<ExposableWebEndpoint> webExposeExcludeProper
115113
}
116114

117115
@Bean
118-
public IncludeExcludeEndpointFilter<ExposableControllerEndpoint> controllerExposeExcludePropertyEndpointFilter() {
116+
@SuppressWarnings("removal")
117+
public IncludeExcludeEndpointFilter<org.springframework.boot.actuate.endpoint.web.annotation.ExposableControllerEndpoint> controllerExposeExcludePropertyEndpointFilter() {
119118
WebEndpointProperties.Exposure exposure = this.properties.getExposure();
120-
return new IncludeExcludeEndpointFilter<>(ExposableControllerEndpoint.class, exposure.getInclude(),
121-
exposure.getExclude());
119+
return new IncludeExcludeEndpointFilter<>(
120+
org.springframework.boot.actuate.endpoint.web.annotation.ExposableControllerEndpoint.class,
121+
exposure.getInclude(), exposure.getExclude());
122122
}
123123

124124
@Configuration(proxyBeanMethods = false)

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/reactive/WebFluxEndpointManagementContextConfiguration.java

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -46,7 +46,6 @@
4646
import org.springframework.boot.actuate.endpoint.web.ExposableWebEndpoint;
4747
import org.springframework.boot.actuate.endpoint.web.WebEndpointsSupplier;
4848
import org.springframework.boot.actuate.endpoint.web.WebServerNamespace;
49-
import org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpointsSupplier;
5049
import org.springframework.boot.actuate.endpoint.web.reactive.AdditionalHealthEndpointPathsWebFluxHandlerMapping;
5150
import org.springframework.boot.actuate.endpoint.web.reactive.ControllerEndpointHandlerMapping;
5251
import org.springframework.boot.actuate.endpoint.web.reactive.WebFluxEndpointHandlerMapping;
@@ -89,10 +88,11 @@ public class WebFluxEndpointManagementContextConfiguration {
8988

9089
@Bean
9190
@ConditionalOnMissingBean
91+
@SuppressWarnings("removal")
9292
public WebFluxEndpointHandlerMapping webEndpointReactiveHandlerMapping(WebEndpointsSupplier webEndpointsSupplier,
93-
ControllerEndpointsSupplier controllerEndpointsSupplier, EndpointMediaTypes endpointMediaTypes,
94-
CorsEndpointProperties corsProperties, WebEndpointProperties webEndpointProperties,
95-
Environment environment) {
93+
org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpointsSupplier controllerEndpointsSupplier,
94+
EndpointMediaTypes endpointMediaTypes, CorsEndpointProperties corsProperties,
95+
WebEndpointProperties webEndpointProperties, Environment environment) {
9696
String basePath = webEndpointProperties.getBasePath();
9797
EndpointMapping endpointMapping = new EndpointMapping(basePath);
9898
Collection<ExposableWebEndpoint> endpoints = webEndpointsSupplier.getEndpoints();
@@ -128,9 +128,10 @@ public AdditionalHealthEndpointPathsWebFluxHandlerMapping managementHealthEndpoi
128128

129129
@Bean
130130
@ConditionalOnMissingBean
131+
@SuppressWarnings("removal")
131132
public ControllerEndpointHandlerMapping controllerEndpointHandlerMapping(
132-
ControllerEndpointsSupplier controllerEndpointsSupplier, CorsEndpointProperties corsProperties,
133-
WebEndpointProperties webEndpointProperties) {
133+
org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpointsSupplier controllerEndpointsSupplier,
134+
CorsEndpointProperties corsProperties, WebEndpointProperties webEndpointProperties) {
134135
EndpointMapping endpointMapping = new EndpointMapping(webEndpointProperties.getBasePath());
135136
return new ControllerEndpointHandlerMapping(endpointMapping, controllerEndpointsSupplier.getEndpoints(),
136137
corsProperties.toCorsConfiguration());

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/servlet/WebMvcEndpointManagementContextConfiguration.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
import org.springframework.boot.actuate.endpoint.web.ExposableWebEndpoint;
4343
import org.springframework.boot.actuate.endpoint.web.WebEndpointsSupplier;
4444
import org.springframework.boot.actuate.endpoint.web.WebServerNamespace;
45-
import org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpointsSupplier;
4645
import org.springframework.boot.actuate.endpoint.web.servlet.AdditionalHealthEndpointPathsWebMvcHandlerMapping;
4746
import org.springframework.boot.actuate.endpoint.web.servlet.ControllerEndpointHandlerMapping;
4847
import org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping;
@@ -84,9 +83,9 @@ public class WebMvcEndpointManagementContextConfiguration {
8483
@SuppressWarnings("removal")
8584
public WebMvcEndpointHandlerMapping webEndpointServletHandlerMapping(WebEndpointsSupplier webEndpointsSupplier,
8685
org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpointsSupplier servletEndpointsSupplier,
87-
ControllerEndpointsSupplier controllerEndpointsSupplier, EndpointMediaTypes endpointMediaTypes,
88-
CorsEndpointProperties corsProperties, WebEndpointProperties webEndpointProperties,
89-
Environment environment) {
86+
org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpointsSupplier controllerEndpointsSupplier,
87+
EndpointMediaTypes endpointMediaTypes, CorsEndpointProperties corsProperties,
88+
WebEndpointProperties webEndpointProperties, Environment environment) {
9089
List<ExposableEndpoint<?>> allEndpoints = new ArrayList<>();
9190
Collection<ExposableWebEndpoint> webEndpoints = webEndpointsSupplier.getEndpoints();
9291
allEndpoints.addAll(webEndpoints);
@@ -124,9 +123,10 @@ public AdditionalHealthEndpointPathsWebMvcHandlerMapping managementHealthEndpoin
124123

125124
@Bean
126125
@ConditionalOnMissingBean
126+
@SuppressWarnings("removal")
127127
public ControllerEndpointHandlerMapping controllerEndpointHandlerMapping(
128-
ControllerEndpointsSupplier controllerEndpointsSupplier, CorsEndpointProperties corsProperties,
129-
WebEndpointProperties webEndpointProperties) {
128+
org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpointsSupplier controllerEndpointsSupplier,
129+
CorsEndpointProperties corsProperties, WebEndpointProperties webEndpointProperties) {
130130
EndpointMapping endpointMapping = new EndpointMapping(webEndpointProperties.getBasePath());
131131
return new ControllerEndpointHandlerMapping(endpointMapping, controllerEndpointsSupplier.getEndpoints(),
132132
corsProperties.toCorsConfiguration());

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/ControllerEndpointsSupplier.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -23,8 +23,11 @@
2323
*
2424
* @author Phillip Webb
2525
* @since 2.0.0
26+
* @deprecated since 3.3.3 in favor of {@code @Endpoint} and {@code @WebEndpoint} support
2627
*/
2728
@FunctionalInterface
29+
@Deprecated(since = "3.3.3", forRemoval = true)
30+
@SuppressWarnings("removal")
2831
public interface ControllerEndpointsSupplier extends EndpointsSupplier<ExposableControllerEndpoint> {
2932

3033
}

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/DiscoveredControllerEndpoint.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -28,6 +28,7 @@
2828
*
2929
* @author Phillip Webb
3030
*/
31+
@SuppressWarnings("removal")
3132
class DiscoveredControllerEndpoint extends AbstractDiscoveredEndpoint<Operation>
3233
implements ExposableControllerEndpoint {
3334

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/ExposableControllerEndpoint.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -28,7 +28,9 @@
2828
*
2929
* @author Phillip Webb
3030
* @since 2.0.0
31+
* @deprecated since 3.3.3 in favor of {@code @Endpoint} and {@code @WebEndpoint} support
3132
*/
33+
@Deprecated(since = "3.3.3", forRemoval = true)
3234
public interface ExposableControllerEndpoint extends ExposableEndpoint<Operation>, PathMappedEndpoint {
3335

3436
/**

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/reactive/ControllerEndpointHandlerMapping.java

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
* @author Phillip Webb
4343
* @since 2.0.0
4444
*/
45+
@SuppressWarnings("removal")
4546
public class ControllerEndpointHandlerMapping extends RequestMappingHandlerMapping {
4647

4748
private final EndpointMapping endpointMapping;

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/servlet/ControllerEndpointHandlerMapping.java

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
* @author Phillip Webb
4444
* @since 2.0.0
4545
*/
46+
@SuppressWarnings("removal")
4647
public class ControllerEndpointHandlerMapping extends RequestMappingHandlerMapping {
4748

4849
private final EndpointMapping endpointMapping;

spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/EndpointLinksResolverTests.java

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
*
3838
* @author Andy Wilkinson
3939
*/
40+
@SuppressWarnings("removal")
4041
class EndpointLinksResolverTests {
4142

4243
@Test

spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/reactive/ControllerEndpointHandlerMappingTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
* @author Phillip Webb
4747
* @author Stephane Nicoll
4848
*/
49-
@SuppressWarnings("removal")
49+
@SuppressWarnings({ "deprecation", "removal" })
5050
class ControllerEndpointHandlerMappingTests {
5151

5252
private final StaticApplicationContext context = new StaticApplicationContext();

spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/servlet/ControllerEndpointHandlerMappingTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
* @author Phillip Webb
4444
* @author Stephane Nicoll
4545
*/
46-
@SuppressWarnings("removal")
46+
@SuppressWarnings({ "deprecation", "removal" })
4747
class ControllerEndpointHandlerMappingTests {
4848

4949
private final StaticApplicationContext context = new StaticApplicationContext();

0 commit comments

Comments
 (0)