Building a Health Check System with Spring Boot and Micrometer

Reliable applications need to tell operators whether they can accept traffic, not merely whether a Java process exists. That distinction matters for Australian services whose users span Sydney, Melbourne and regional centres, where cloud regions, network paths and upstream providers can fail independently. For telehealth, booking and e-commerce platforms, dependable application health monitoring supports safe failover and clearer incident response.

Spring Boot Actuator exposes operational endpoints, while Micrometer records measurements through a metrics facade. Combined, they provide liveness and readiness probes, dependency checks and telemetry that can feed Prometheus or a cloud monitoring service. The design should reveal useful status without exposing infrastructure or customer information.

Separating liveness from readiness

A liveness probe answers one narrow question: is this process healthy enough that restarting it may help? It should avoid remote calls because an unreachable authentication provider does not mean the JVM needs restarting. A failed liveness state should lead to controlled recovery rather than a restart loop.

A readiness probe asks whether the instance should receive requests now. It can include the database, required APIs and application state, but only dependencies whose failure makes the service unusable. Teams operating across Australian Eastern Standard Time and Australian Eastern Daylight Time should account for daylight-saving transitions when scheduling maintenance or simulating failover.

Configuring Spring Boot Actuator

Add the Spring Boot Actuator starter and, when collecting Prometheus-compatible measurements, the Micrometer Prometheus registry. Keep management endpoints on a separate port where possible, then expose only the required paths:

management:
  server:
    port: 9090
  endpoints:
    web:
      exposure:
        include: health,info,metrics,prometheus
  endpoint:
    health:
      show-details: never
      probes:
        enabled: true
      group:
        readiness:
          include: readinessState,db

Actuator maps liveness and readiness to /actuator/health/liveness and /actuator/health/readiness. A load balancer can query readiness before routing traffic, while an orchestration platform can use liveness to decide whether to replace a process. Add custom health contributors to the readiness group only when they represent mandatory capabilities. The show-details setting prevents component names, connection information and exception details from appearing in ordinary responses.

Measuring runtime behaviour with Micrometer

Micrometer complements state-based checks with measurable trends. Use a Timer for request and dependency latency, a Counter for failures and a Gauge for fluctuating values such as active database connections. Add dimensions such as route templates and status classes, but avoid customer identifiers and other high-cardinality values that could make the monitoring system expensive.

A custom HealthIndicator can wrap a critical service. For example, an Australian checkout system might classify its payment gateway as unavailable after a short, bounded timeout and increment a Micrometer failure counter. Avoid checking a third-party API on every request: repeated probes can create unnecessary load, produce misleading results and contribute to an outage at the provider.

Selecting signals that support operations

Application-level indicators should explain pressure on the service:

Dependency-level indicators should reveal whether critical connections remain usable:

Dashboards in Grafana, Prometheus or an Australian cloud monitoring service can combine these measurements with readiness status. Thresholds should reflect measured baselines rather than arbitrary values, while alerts should distinguish a failing instance from a widespread dependency outage. This avoids paging operators for every short-lived fluctuation and keeps the signal useful during busy retail periods or public-health campaigns.

Securing diagnostics and preparing for failure

Health endpoints can disclose component names, software versions and dependency failures, so restrict management traffic to load balancers, monitoring agents or an operations VPN. Keep the management port away from direct public access, authenticate administrative requests and expose only a basic status to general callers. Following APRA-aligned privacy practices and ACSC guidance means keeping customer records, credentials and connection strings out of diagnostic output.

Failure drills should cover unavailable databases, expired credentials, slow payment gateways and congested queues. Run them with the same alerting rules used in production, and route critical notifications to a staffed Australian on-call team rather than relying solely on business-hours email. Record ownership, escalation paths and safe remediation steps for every readiness failure.

Together, Actuator and Micrometer create an operational feedback loop: probes guide traffic and recovery decisions, while measurements explain changes in service quality. The result is a health-check system that reflects real application dependencies without revealing sensitive details or generating avoidable alert fatigue.