An Actuator endpoint lets you inspect or influence a running Spring Boot application. Add the Actuator starter to make built-in endpoints available. They report information such as health, configuration, and metrics; some also accept operations that change the running application. Endpoints are available over HTTP and, with the exception of /heapdump, as JMX MBeans. section 15.1 section 15.5
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency>
Add this dependency to a Maven pom.xml to equip a Spring Boot application with Actuator endpoints. section 15.1
HTTP endpoint paths start with /actuator by default: GET /actuator/health requests health information. Set management.endpoints.web.base-path to change the prefix, for example to /management. Only /health is exposed by default in this setup; opt in to other web endpoints deliberately because they can reveal sensitive information. section 15.1.1 section 15.1.2
management:
endpoints:
web:
exposure:
include: health,info,beans,conditions
This YAML exposes just health, info, beans, and conditions. Use management.endpoints.web.exposure.include and exclude to control which web endpoints are exposed. section 15.1.2
Choose an endpoint for the question you need to answer:
- /health reports application health; /info can provide build and Git commit details. section 15.1 section 15.5
- /beans describes application-context beans; /conditions reports which autoconfiguration conditions passed or failed. section 15.1
- /metrics provides runtime measurements; /env and /loggers can support changes to a running application’s configuration. section 15.2.4 section 15.5
Find a request metric
Use curl to GET /actuator and discover links to exposed endpoints. Then GET /actuator/metrics/http.server.requests for request counts and timings. Add tag=status:404 to narrow the measurements to 404 responses; available tags narrow along with the results. section 15.2 section 15.2.4
A custom endpoint is not an ordinary Spring MVC controller. Annotate a component class with @Endpoint(id="notes"), then mark its methods with @ReadOperation, @WriteOperation, or @DeleteOperation. A notes endpoint can use those operations to list, add, and remove notes. The annotations describe operations without tying the class to HTTP alone. section 15.3.4
Secure exposed endpoints with Spring Security, especially those that reveal details or permit changes. EndpointRequest.toAnyEndpoint() matches Actuator endpoints without hardcoding /actuator/**, so the rule can survive a base-path change. For a friendlier view of endpoint data, Spring Boot Admin can consume it and display it in a web application. section 15.4 section 16.4
