@Endpoint marks a Spring bean as a Spring Boot Actuator endpoint, and @ReadOperation marks the method that answers a read request, which over HTTP is a GET. Together they let you add your own management endpoint, such as /actuator/buildinfo, that is exposed over HTTP and JMX using the same rules as the built-in ones.
An endpoint is technology-agnostic: you write it once and Actuator adapts it to each exposure technology. You must also expose it explicitly, because only a few endpoints are exposed over the web by default.
@Endpoint is in org.springframework.boot.actuate.endpoint.annotation. Put it on a Spring bean and give it an id, which becomes the path segment under /actuator (or the JMX attribute name).
Endpoint ids must be lowercase alphanumeric and start with a letter. Camel-case ids such as customEndpoint are not valid in current Spring Boot versions and cause a startup warning or failure, so avoid them.
Adding the class is not enough. Over HTTP, Spring Boot exposes only health by default, and JMX exposes more. Include your endpoint in application.properties:
Then call it:
Returning a Map or a simple object produces JSON. A plain String is also serialised as JSON, so it comes back with quotation marks. The response media type is the Actuator one, application/vnd.spring-boot.actuator.v3+json, and application/json is accepted too.
There are three operation annotations, and each maps to an HTTP verb for web exposure:
| Annotation | HTTP method | Typical use |
|---|---|---|
@ReadOperation | GET | Return state or diagnostics |
@WriteOperation | POST | Change state, for example set a flag |
@DeleteOperation | DELETE | Remove or reset something |
Method parameters are not bound with @RequestParam. For a read, they come from query parameters; for a write, they come from the JSON request body. A parameter is required unless you mark it with an annotation named @Nullable.
@Selector turns a parameter into a path variable, so GET /actuator/featureflags/beta calls one("beta"). A write call sends JSON:
Operations that return void respond with 204 No Content, and a null result from a read responds with 404.
@Endpoint is available over every technology. If you need one technology only, use a specialised annotation:
@WebEndpoint exposes the endpoint over HTTP only.@JmxEndpoint exposes it over JMX only.@EndpointWebExtension adds web-specific behaviour, such as a different response type, to an existing endpoint.Management endpoints often reveal internals and a write operation changes live state, so treat them as sensitive:
* on a public interface./actuator/** with Spring Security and a dedicated role.management.server.port, reachable only from your internal network.management.endpoint.<id>.access accepts none, read-only or unrestricted; older versions use management.endpoint.<id>.enabled.Most often it is not exposed. Add its id to management.endpoints.web.exposure.include, and check that the class is a Spring bean that component scanning picks up.
An endpoint lives under the actuator base path, follows the exposure and security settings, and works over JMX as well. A @RestController is an ordinary application controller.
Yes. Plain parameters come from query parameters, and @Selector parameters come from the path.
Call the class directly in a unit test, or use @SpringBootTest with a web environment and management.endpoints.web.exposure.include set for the test.
Annotate a bean with @Endpoint(id = "...") and its methods with @ReadOperation, @WriteOperation and @DeleteOperation to build a custom actuator endpoint. Use a lowercase alphanumeric id, expose it explicitly, use @Selector for path variables, and secure it like any other administrative interface.