Skip to content

Commit 734b79e

Browse files
committed
Remove most deprecated APIs that were due for removal in 4.0
Support for rest controller, controler, and servlet endpoints has been kept for now. Issue: 45600
1 parent 5ad8726 commit 734b79e

File tree

196 files changed

+104
-10960
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

196 files changed

+104
-10960
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/condition/ConditionalOnAvailableEndpoint.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2024 the original author or authors.
2+
* Copyright 2012-2025 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.
@@ -34,9 +34,9 @@
3434
* endpoint is considered available if it is both enabled and exposed on the specified
3535
* technologies.
3636
* <p>
37-
* Matches enablement according to the endpoints specific {@link Environment} property,
38-
* falling back to {@code management.endpoints.enabled-by-default} or failing that
39-
* {@link Endpoint#enableByDefault()}.
37+
* Matches access according to the endpoint's specific {@link Environment} property,
38+
* falling back to {@code management.endpoints.default-access} or failing that
39+
* {@link Endpoint#defaultAccess()}.
4040
* <p>
4141
* Matches exposure according to any of the {@code management.endpoints.web.exposure.<id>}
4242
* or {@code management.endpoints.jmx.exposure.<id>} specific properties or failing that

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/condition/OnAvailableEndpointCondition.java

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2024 the original author or authors.
2+
* Copyright 2012-2025 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.
@@ -17,7 +17,6 @@
1717
package org.springframework.boot.actuate.autoconfigure.endpoint.condition;
1818

1919
import java.util.Arrays;
20-
import java.util.Collection;
2120
import java.util.EnumSet;
2221
import java.util.LinkedHashSet;
2322
import java.util.List;
@@ -126,8 +125,7 @@ private ConditionOutcome getMatchOutcome(ConditionContext context,
126125
private ConditionOutcome getAccessOutcome(Environment environment, MergedAnnotation<Endpoint> endpointAnnotation,
127126
EndpointId endpointId, ConditionMessage.Builder message) {
128127
Access defaultAccess = endpointAnnotation.getEnum("defaultAccess", Access.class);
129-
boolean enableByDefault = endpointAnnotation.getBoolean("enableByDefault");
130-
Access access = getAccess(environment, endpointId, (enableByDefault) ? defaultAccess : Access.NONE);
128+
Access access = getAccess(environment, endpointId, defaultAccess);
131129
return new ConditionOutcome(access != Access.NONE,
132130
message.because("the configured access for endpoint '%s' is %s".formatted(endpointId, access)));
133131
}
@@ -153,17 +151,8 @@ private ConditionOutcome getExposureOutcome(ConditionContext context,
153151

154152
private Set<EndpointExposure> getExposures(MergedAnnotation<ConditionalOnAvailableEndpoint> conditionAnnotation) {
155153
EndpointExposure[] exposures = conditionAnnotation.getEnumArray("exposure", EndpointExposure.class);
156-
return replaceCloudFoundryExposure(
157-
(exposures.length == 0) ? EnumSet.allOf(EndpointExposure.class) : Arrays.asList(exposures));
158-
}
159-
160-
@SuppressWarnings("removal")
161-
private Set<EndpointExposure> replaceCloudFoundryExposure(Collection<EndpointExposure> exposures) {
162-
Set<EndpointExposure> result = EnumSet.copyOf(exposures);
163-
if (result.remove(EndpointExposure.CLOUD_FOUNDRY)) {
164-
result.add(EndpointExposure.WEB);
165-
}
166-
return result;
154+
return (exposures.length == 0) ? EnumSet.allOf(EndpointExposure.class)
155+
: EnumSet.copyOf(Arrays.asList(exposures));
167156
}
168157

169158
private Set<EndpointExposureOutcomeContributor> getExposureOutcomeContributors(ConditionContext context) {

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/expose/EndpointExposure.java

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2024 the original author or authors.
2+
* Copyright 2012-2025 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.
@@ -32,16 +32,7 @@ public enum EndpointExposure {
3232
/**
3333
* Exposed over a web endpoint.
3434
*/
35-
WEB("health"),
36-
37-
/**
38-
* Exposed on Cloud Foundry over `/cloudfoundryapplication`.
39-
* @since 2.6.4
40-
* @deprecated since 3.4.0 for removal in 4.0.0 in favor of using
41-
* {@link EndpointExposure#WEB}
42-
*/
43-
@Deprecated(since = "3.4.0", forRemoval = true)
44-
CLOUD_FOUNDRY("*");
35+
WEB("health");
4536

4637
private final String[] defaultIncludes;
4738

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementWebServerFactoryCustomizer.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,6 @@ public class ManagementWebServerFactoryCustomizer<T extends ConfigurableWebServe
4646

4747
private final Class<? extends WebServerFactoryCustomizer<?>>[] customizerClasses;
4848

49-
@SafeVarargs
50-
@SuppressWarnings("varargs")
51-
@Deprecated(since = "3.5.0", forRemoval = true)
52-
protected ManagementWebServerFactoryCustomizer(ListableBeanFactory beanFactory,
53-
Class<? extends WebServerFactoryCustomizer<?>>... customizerClasses) {
54-
this.beanFactory = beanFactory;
55-
this.customizerClasses = customizerClasses;
56-
}
57-
5849
/**
5950
* Creates a new customizer that will retrieve beans using the given
6051
* {@code beanFactory}.

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/condition/ConditionalOnAvailableEndpointTests.java

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -273,21 +273,6 @@ void whenBothDefaultAccessAndDefaultEnabledAreConfiguredThenThrows() {
273273
.isInstanceOf(MutuallyExclusiveConfigurationPropertiesException.class));
274274
}
275275

276-
@Test
277-
void whenDisabledAndAccessibleByDefaultEndpointIsNotAvailable() {
278-
this.contextRunner.withUserConfiguration(DisabledButAccessibleEndpointConfiguration.class)
279-
.withPropertyValues("management.endpoints.web.exposure.include=*")
280-
.run((context) -> assertThat(context).doesNotHaveBean(DisabledButAccessibleEndpoint.class));
281-
}
282-
283-
@Test
284-
void whenDisabledAndAccessibleByDefaultEndpointCanBeAvailable() {
285-
this.contextRunner.withUserConfiguration(DisabledButAccessibleEndpointConfiguration.class)
286-
.withPropertyValues("management.endpoints.web.exposure.include=*",
287-
"management.endpoints.access.default=unrestricted")
288-
.run((context) -> assertThat(context).hasSingleBean(DisabledButAccessibleEndpoint.class));
289-
}
290-
291276
@Test
292277
@WithTestEndpointOutcomeExposureContributor
293278
void exposureOutcomeContributorCanMakeEndpointAvailable() {
@@ -325,12 +310,6 @@ static class DashedEndpoint {
325310

326311
}
327312

328-
@SuppressWarnings({ "deprecation", "removal" })
329-
@Endpoint(id = "disabledbutaccessible", enableByDefault = false)
330-
static class DisabledButAccessibleEndpoint {
331-
332-
}
333-
334313
@EndpointExtension(endpoint = SpringEndpoint.class, filter = TestFilter.class)
335314
static class SpringEndpointExtension {
336315

@@ -430,15 +409,4 @@ String unexposed() {
430409

431410
}
432411

433-
@Configuration(proxyBeanMethods = false)
434-
static class DisabledButAccessibleEndpointConfiguration {
435-
436-
@Bean
437-
@ConditionalOnAvailableEndpoint
438-
DisabledButAccessibleEndpoint disabledButAccessible() {
439-
return new DisabledButAccessibleEndpoint();
440-
}
441-
442-
}
443-
444412
}

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/AbstractExposableEndpoint.java

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,6 @@ public abstract class AbstractExposableEndpoint<O extends Operation> implements
3636

3737
private final List<O> operations;
3838

39-
/**
40-
* Create a new {@link AbstractExposableEndpoint} instance.
41-
* @param id the endpoint id
42-
* @param enabledByDefault if the endpoint is enabled by default
43-
* @param operations the endpoint operations
44-
* @deprecated since 3.4.0 for removal in 4.0.0 in favor of
45-
* {@link #AbstractExposableEndpoint(EndpointId, Access, Collection)}
46-
*/
47-
@Deprecated(since = "3.4.0", forRemoval = true)
48-
public AbstractExposableEndpoint(EndpointId id, boolean enabledByDefault, Collection<? extends O> operations) {
49-
this(id, (enabledByDefault) ? Access.UNRESTRICTED : Access.READ_ONLY, operations);
50-
}
51-
5239
/**
5340
* Create a new {@link AbstractExposableEndpoint} instance.
5441
* @param id the endpoint id
@@ -69,13 +56,6 @@ public EndpointId getEndpointId() {
6956
return this.id;
7057
}
7158

72-
@Override
73-
@SuppressWarnings("removal")
74-
@Deprecated(since = "3.4.0", forRemoval = true)
75-
public boolean isEnableByDefault() {
76-
return this.defaultAccess != Access.NONE;
77-
}
78-
7959
@Override
8060
public Access getDefaultAccess() {
8161
return this.defaultAccess;

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/ExposableEndpoint.java

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2024 the original author or authors.
2+
* Copyright 2012-2025 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.
@@ -34,15 +34,6 @@ public interface ExposableEndpoint<O extends Operation> {
3434
*/
3535
EndpointId getEndpointId();
3636

37-
/**
38-
* Returns if the endpoint is enabled by default.
39-
* @return if the endpoint is enabled by default
40-
* @deprecated since 3.4.0 for removal in 4.0.0 in favor of
41-
* {@link #getDefaultAccess()}
42-
*/
43-
@Deprecated(since = "3.4.0", forRemoval = true)
44-
boolean isEnableByDefault();
45-
4637
/**
4738
* Returns the access to the endpoint that is permitted by default.
4839
* @return access that is permitted by default

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

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,6 @@ public abstract class AbstractDiscoveredEndpoint<O extends Operation> extends Ab
4141

4242
private final Object endpointBean;
4343

44-
/**
45-
* Create a new {@link AbstractDiscoveredEndpoint} instance.
46-
* @param discoverer the discoverer that discovered the endpoint
47-
* @param endpointBean the primary source bean
48-
* @param id the ID of the endpoint
49-
* @param enabledByDefault if the endpoint is enabled by default
50-
* @param operations the endpoint operations
51-
* @deprecated since 3.4.0 for removal in 4.0.0 in favor of
52-
* {@link #AbstractDiscoveredEndpoint(EndpointDiscoverer, Object, EndpointId, Access, Collection)}
53-
*/
54-
@SuppressWarnings("removal")
55-
@Deprecated(since = "3.4.0", forRemoval = true)
56-
public AbstractDiscoveredEndpoint(EndpointDiscoverer<?, ?> discoverer, Object endpointBean, EndpointId id,
57-
boolean enabledByDefault, Collection<? extends O> operations) {
58-
this(discoverer, endpointBean, id, (enabledByDefault) ? Access.UNRESTRICTED : Access.READ_ONLY, operations);
59-
}
60-
6144
/**
6245
* Create a new {@link AbstractDiscoveredEndpoint} instance.
6346
* @param discoverer the discoverer that discovered the endpoint

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

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2024 the original author or authors.
2+
* Copyright 2012-2025 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.
@@ -63,14 +63,6 @@
6363
*/
6464
String id() default "";
6565

66-
/**
67-
* If the endpoint should be enabled or disabled by default.
68-
* @return {@code true} if the endpoint is enabled by default
69-
* @deprecated since 3.4.0 for removal in 4.0.0 in favor of {@link #defaultAccess()}
70-
*/
71-
@Deprecated(since = "3.4.0", forRemoval = true)
72-
boolean enableByDefault() default true;
73-
7466
/**
7567
* Level of access to the endpoint that is permitted by default.
7668
* @return the default level of access

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

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -84,21 +84,6 @@ public abstract class EndpointDiscoverer<E extends ExposableEndpoint<O>, O exten
8484

8585
private volatile Collection<E> endpoints;
8686

87-
/**
88-
* Create a new {@link EndpointDiscoverer} instance.
89-
* @param applicationContext the source application context
90-
* @param parameterValueMapper the parameter value mapper
91-
* @param invokerAdvisors invoker advisors to apply
92-
* @param endpointFilters endpoint filters to apply
93-
* @deprecated since 3.4.0 for removal in 4.0.0 in favor of
94-
* {@link #EndpointDiscoverer(ApplicationContext, ParameterValueMapper, Collection, Collection, Collection)}
95-
*/
96-
@Deprecated(since = "3.4.0", forRemoval = true)
97-
public EndpointDiscoverer(ApplicationContext applicationContext, ParameterValueMapper parameterValueMapper,
98-
Collection<OperationInvokerAdvisor> invokerAdvisors, Collection<EndpointFilter<E>> endpointFilters) {
99-
this(applicationContext, parameterValueMapper, invokerAdvisors, endpointFilters, Collections.emptyList());
100-
}
101-
10287
/**
10388
* Create a new {@link EndpointDiscoverer} instance.
10489
* @param applicationContext the source application context
@@ -381,21 +366,6 @@ protected Class<? extends E> getEndpointType() {
381366
return (Class<? extends E>) ResolvableType.forClass(EndpointDiscoverer.class, getClass()).resolveGeneric(0);
382367
}
383368

384-
/**
385-
* Factory method called to create the {@link ExposableEndpoint endpoint}.
386-
* @param endpointBean the source endpoint bean
387-
* @param id the ID of the endpoint
388-
* @param enabledByDefault if the endpoint is enabled by default
389-
* @param operations the endpoint operations
390-
* @return a created endpoint (a {@link DiscoveredEndpoint} is recommended)
391-
* @deprecated since 3.4.0 for removal in 4.0.0 in favor of
392-
* {@link #createEndpoint(Object, EndpointId, Access, Collection)}
393-
*/
394-
@Deprecated(since = "3.4.0", forRemoval = true)
395-
protected E createEndpoint(Object endpointBean, EndpointId id, boolean enabledByDefault, Collection<O> operations) {
396-
return createEndpoint(endpointBean, id, (enabledByDefault) ? Access.UNRESTRICTED : Access.NONE, operations);
397-
}
398-
399369
/**
400370
* Factory method called to create the {@link ExposableEndpoint endpoint}.
401371
* @param endpointBean the source endpoint bean
@@ -498,8 +468,7 @@ private static class EndpointBean {
498468
this.beanType = beanType;
499469
this.beanSupplier = beanSupplier;
500470
this.id = EndpointId.of(environment, id);
501-
boolean enabledByDefault = annotation.getBoolean("enableByDefault");
502-
this.defaultAccess = enabledByDefault ? annotation.getEnum("defaultAccess", Access.class) : Access.NONE;
471+
this.defaultAccess = annotation.getEnum("defaultAccess", Access.class);
503472
this.filter = getFilter(beanType);
504473
}
505474

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/invoke/reflect/OperationMethod.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public class OperationMethod {
4949
* @param method the source method
5050
* @param operationType the operation type
5151
* @deprecated since 4.0.0 for removal in 4.2.0 in favor of
52-
* {@link #OperationMethod(Method, OperationType, Predicate)}p
52+
* {@link #OperationMethod(Method, OperationType, Predicate)}
5353
*/
5454
@Deprecated(since = "4.0.0", forRemoval = true)
5555
public OperationMethod(Method method, OperationType operationType) {

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/annotation/JmxEndpoint.java

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2024 the original author or authors.
2+
* Copyright 2012-2025 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.
@@ -48,15 +48,6 @@
4848
@AliasFor(annotation = Endpoint.class)
4949
String id() default "";
5050

51-
/**
52-
* If the endpoint should be enabled or disabled by default.
53-
* @return {@code true} if the endpoint is enabled by default
54-
* @deprecated since 3.4.0 for removal in 4.0.0 in favor of
55-
*/
56-
@Deprecated(since = "3.4.0", forRemoval = true)
57-
@AliasFor(annotation = Endpoint.class)
58-
boolean enableByDefault() default true;
59-
6051
/**
6152
* Level of access to the endpoint that is permitted by default.
6253
* @return the default level of access

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/annotation/JmxEndpointDiscoverer.java

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2024 the original author or authors.
2+
* Copyright 2012-2025 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.
@@ -17,7 +17,6 @@
1717
package org.springframework.boot.actuate.endpoint.jmx.annotation;
1818

1919
import java.util.Collection;
20-
import java.util.Collections;
2120

2221
import org.springframework.aot.hint.MemberCategory;
2322
import org.springframework.aot.hint.RuntimeHints;
@@ -48,22 +47,6 @@
4847
public class JmxEndpointDiscoverer extends EndpointDiscoverer<ExposableJmxEndpoint, JmxOperation>
4948
implements JmxEndpointsSupplier {
5049

51-
/**
52-
* Create a new {@link JmxEndpointDiscoverer} instance.
53-
* @param applicationContext the source application context
54-
* @param parameterValueMapper the parameter value mapper
55-
* @param invokerAdvisors invoker advisors to apply
56-
* @param endpointFilters endpoint filters to apply
57-
* @deprecated since 3.4.0 for removal in 4.0.0 in favor of
58-
* {@link #JmxEndpointDiscoverer(ApplicationContext, ParameterValueMapper, Collection, Collection, Collection)}
59-
*/
60-
@Deprecated(since = "3.4.0", forRemoval = true)
61-
public JmxEndpointDiscoverer(ApplicationContext applicationContext, ParameterValueMapper parameterValueMapper,
62-
Collection<OperationInvokerAdvisor> invokerAdvisors,
63-
Collection<EndpointFilter<ExposableJmxEndpoint>> endpointFilters) {
64-
this(applicationContext, parameterValueMapper, invokerAdvisors, endpointFilters, Collections.emptyList());
65-
}
66-
6750
/**
6851
* Create a new {@link JmxEndpointDiscoverer} instance.
6952
* @param applicationContext the source application context

0 commit comments

Comments
 (0)