liveBook · Manning

Health check endpoint

As explained in Spring in Action, Sixth Edition

A health endpoint is an Actuator HTTP endpoint that returns the health status of an application and optionally its health-indicator details.

A health check endpoint reports whether a running application is healthy. In a Spring Boot application, Actuator serves this information as JSON through an HTTP GET request. The default URL is /actuator/health, although the Actuator base path can be changed. section 15.2.1 section 15.1.1

Check application health

Request the endpoint with curl:\n\n$ curl localhost:8080/actuator/health\n{"status":"UP"}\n\nA status of UP indicates that the application reports itself as healthy. Configure management.endpoints.web.base-path as /management when the endpoint should instead be reached at /management/health. section 15.2.1 section 15.1.1

The response can include health-indicator details as well as the overall status. Set management.endpoint.health.show-details to always to expose information such as MongoDB status, database version, disk capacity, free space, and the disk-space threshold. section 15.2.1

Use the endpoint with these operational considerations:

  • Keep the default health endpoint available; it is enabled by default while most other Actuator endpoints are not. section 15.1.2
  • Control exposed endpoints with management.endpoints.web.exposure.include and management.endpoints.web.exposure.exclude. section 15.1.2
  • Secure additional exposed Actuator endpoints with Spring Security because Actuator does not secure them by itself. section 15.1.2
{
  "status": "UP",
  "details": {
    "mongo": {
      "status": "UP",
      "details": {
        "version": "3.5.5"
      }
    },
    "diskSpace": {
      "status": "UP",
      "details": {
        "total": 499963170816,
        "free": 177284784128,
        "threshold": 10485760
      }
    }
  }
}

Inspect an expanded health response showing overall status alongside MongoDB and disk-space indicators. section 15.2.1

Spring Boot Admin can display health and general application information under its Details view, alongside JVM statistics such as memory, thread, processor, and garbage-collection data. section 16.2.1

How Spring in Action, Sixth Edition covers it

How deep it goes
Explains requests, JSON status, indicator details, path configuration, exposure, and security, but not custom health-indicator implementation.
Examples
Uses curl responses, YAML path and exposure settings, and MongoDB and disk-space health details.
What you can do after
Operate and configure the endpoint, inspect health JSON, change its base path, expose details, and control related endpoint exposure.
How it connects
Connects health checks with Spring Boot Actuator, Spring Boot Admin, Spring Security, MongoDB, disk space, and JVM monitoring.

Also explained in

Compare how 5 books explain health check endpoint →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Spring in Action, Sixth Edition. The section links point to the parts of the book it draws on.