Video in progress

What is the /actuator/health endpoint in Spring Boot Actuator for?

It tells external systems whether the application is alive and can accept requests. Load balancers, Kubernetes and monitoring use this endpoint to decide whether to send traffic to the app or restart it.

📖 Answer

One dependency is enough to turn it on:

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
curl localhost:8080/actuator/health
# {"status":"UP"}

Actuator wires in several checks on its own: the DB connection, disk space, Redis and others (if the library is on the classpath). If one of them is DOWN, the overall status is DOWN too and it returns HTTP 503.

management:
  endpoint:
    health:
      show-details: when-authorized   # do not show details to everyone

When running in Kubernetes, Spring Boot also provides separate /actuator/health/liveness and /actuator/health/readiness groups, and those are the ones to use for probes. Do not expose Actuator's other endpoints (env, heapdump) to the outside.