How to create Health Check API using Actuator


Spring Boot actuator will provides some features such as monitoring, metrics, health check, mapping and beans etc. Spring Boot provides a spring boot actuator dependency to auto configure Actuator. Follow given step to add Actuator in your application.
Step 1: Add given dependency in pom.xml file

<dependency>
    <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

Step 2: Add given properties in application.properties file.

management.endpoints.web.exposure.include=*
management.endpoint.health.show-details=always

Now Actuator is added to your application.

1) Health EndPoint: –
The /health endpoint shows the health of the application, including the database disk space and database status.

URL: – http://localhost:8080/actuator/health

2) Metrics EndPoint: –
The /metrics endpoint shows various metrix about the current application such as

  • How much memory is using
  • How much memory is free
  • The size of the heap user
  • The number of threads used

URL: – http://localhost:8080/actuator/metrics

For Other EndPoint you will check http://localhost:8080/actuator

Download document link

That’s all.