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
This commit is contained in:
Brian Clozel
2024-04-15 13:43:32 +02:00
parent 34c60751e9
commit 647a5ec6be
44 changed files with 91 additions and 47 deletions

View File

@@ -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]

View File

@@ -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<EndpointServlet>`.
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