We can monitor and manage a spring boot application using actuators. It is a very useful feature for troubleshooting in production. This quick guide shows you:
- How to add/enable Spring Boot Actuator to an application ?
- How to indent the JSON output in Spring boot actuator pages ?
- How to see detailed health statuses in /actuator/health endpoint ?
How to add/enable Spring Boot Actuator to an application ?
- The recommended way to enable actuator is to add the
spring-boot-starter-actuator
dependency.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
- It provides a number of built-in endpoints and lets us add our own too. All endpoints should be enabled & exposed to be available. So 2 steps. But by default all endpoints other than
shutdown
are enabled. But onlyhealth
endpoint is exposed by default. In other words, only/actuator/health
is available by default.
So if we want info
and metrics
endpoints to be available then we need to expose them by adding a property to application.properties
#application.properties
management.endpoints.web.exposure.include=info, metrics
#application.yml
management:
endpoints:
web:
exposure:
include: info, metrics
We can view the list of all available actuator endpoints under http://localhost:8082/actuator

If you need to expose all the actuator endpoints use the wildcard character “*”.
# For application.properties
management.endpoints.web.exposure.include=*
#For application.yml
management:
endpoints:
web:
exposure:
include: "*"
Some of the commonly used actuator endpoints are provided below.
Endpoint | Description |
---|---|
actuator/beans | Displays a complete list of all the available spring beans in your application. |
actuator/health | Shows application health information. |
actuator/info | Displays arbitrary application info. |
actuator/metrics | Shows metrics information |
actuator/scheduledtasks | Displays the scheduled tasks in your application. |
How to indent the JSON output in Spring boot actuator pages ?
To indent the json output in spring boot actuator health or info pages add the below property to application.properties
#application.properties
spring.jackson.serialization.INDENT_OUTPUT = true
#application.yml
spring:
jackson:
serialization:
INDENT_OUTPUT: true
How to enable showing detailed health status in /actuator/health endpoint ?
By default the /actuator/health endpoint will only show the summarized health status.
{
"status" : "UP"
}
If we want to see the detailed health information in /actuator/health endpoint, we need to add the below property to application.properties
#application.properties
management.endpoint.health.show-details = always
#application.yml
management:
endpoint:
health:
show-details: always
