Actuator

Master Spring Boot Actuator — the production-ready features for health checks, metrics, info, and management endpoints that every enterprise Spring Boot application needs.

Last reviewed: January 2025

·Spring Boot 2.7Spring Boot 3.x
✅
Quick Understanding: Spring Boot Actuator adds production-ready endpoints to your application. Add spring-boot-starter-actuator and you get /actuator/health (Kubernetes readiness/liveness probes), /actuator/metrics (performance data), /actuator/info (app version), and more. Secure them — never expose all Actuator endpoints publicly.

🔍 What Is It?

Spring Boot Actuator provides HTTP endpoints for monitoring and managing your application.

Key endpoints:

  • →/actuator/health — application health (UP/DOWN) + component details
  • →/actuator/metrics — metrics (JVM, HTTP, DB connection pool, custom)
  • →/actuator/info — application info (version, build time)
  • →/actuator/env — all environment properties (sensitive!)
  • →/actuator/loggers — view and change log levels at runtime
  • →/actuator/threaddump — thread dump for debugging
  • →/actuator/heapdump — heap dump for memory analysis
  • →/actuator/prometheus — Prometheus-format metrics scraping
  • →/actuator/shutdown — graceful shutdown (disabled by default)
  • →/actuator/refresh — refresh @RefreshScope beans (Spring Cloud)

Kubernetes integration:

  • →/actuator/health/liveness — is the app alive? (restart if DOWN)
  • →/actuator/health/readiness — is the app ready for traffic? (remove from load balancer if DOWN)

🎯 Why Do We Need It?

Production applications need observability:

  • →Kubernetes needs /health for liveness and readiness probes
  • →Prometheus scrapes /actuator/prometheus for metrics
  • →Operations team needs /actuator/loggers to debug without restart
  • →Security team needs /actuator/env to verify config (access-controlled)
  • →On-call engineers need /actuator/threaddump for deadlock debugging

🏗️ What Happens in Real Projects?

Every production Spring Boot service exposes:

  • →/actuator/health for Kubernetes probes
  • →/actuator/prometheus for Prometheus/Grafana metrics
  • →/actuator/info for deployment tracking
  • →/actuator/loggers for runtime log level changes

⚙️ How It Works

Actuator endpoints are auto-configured when spring-boot-starter-actuator is on the classpath. Each endpoint is a Spring MVC (or WebFlux) controller. You control which are enabled and which are exposed via HTTP through properties.

💻 Example

Actuator Configuration — Secure Actuator setup for production with Kubernetes probes.

yaml
management:
  endpoints:
    web:
      exposure:
        include: health,info,metrics,prometheus,loggers
        # Never expose: env, heapdump, threaddump publicly
        # Expose all in dev: include: "*"
  endpoint:
    health:
      show-details: when-authorized  # Only show details to authenticated users
      probes:
        enabled: true  # Enable /health/liveness and /health/readiness
    info:
      enabled: true
  health:
    livenessState:
      enabled: true
    readinessState:
      enabled: true
    db:
      enabled: true
    diskSpace:
      enabled: true
    redis:
      enabled: true

info:
  app:
    name: ${spring.application.name}
    version: @project.version@
    build-time: @maven.build.timestamp@
  java:
    version: ${java.version}

🤔 Common Confusions

❓ What is the difference between liveness and readiness probes?

Liveness: is the app alive? If DOWN, Kubernetes restarts the pod. Use for deadlocks or unrecoverable states. Readiness: is the app ready to serve traffic? If DOWN, Kubernetes removes the pod from the load balancer but doesn't restart it. Use for temporary unavailability (DB connection lost, cache warming). Spring Boot maps these to /actuator/health/liveness and /actuator/health/readiness.

❓ Are Actuator endpoints secure by default?

Only /actuator/health and /actuator/info are exposed by default. Others must be explicitly enabled. But even /actuator/health can expose sensitive info (DB credentials in error messages) with show-details=always. Always secure Actuator endpoints with authentication or IP restriction in production.

🚨 Common Production Issues

/actuator/env exposed publicly showing database passwords and API keys

Health endpoint returning DOWN due to a non-critical component (cache) causing unnecessary Kubernetes restarts

Liveness probe too aggressive — restarting pods during high load instead of waiting

No readiness probe — traffic routed to pods that aren't ready yet

✅ Best Practices

Only expose health, info, metrics, prometheus in production

Secure Actuator endpoints with IP restriction or authentication

Use separate liveness and readiness probes in Kubernetes

Configure health groups — separate critical from non-critical health checks

Add custom health indicators for external dependencies

Use /actuator/loggers to change log levels in production without restart

🏛️ Architect's Note

Senior Architect's Perspective

Actuator + Micrometer + Prometheus + Grafana is the standard observability stack for Spring Boot in production. Actuator exposes metrics, Micrometer translates them to Prometheus format, Prometheus scrapes and stores them, Grafana visualizes them. Spring Boot auto-configures all of this — add spring-boot-starter-actuator and micrometer-registry-prometheus and you have metrics in Grafana in minutes.

💬 Frequently Asked Questions

How do I add custom metrics?

Inject MeterRegistry and use it: meterRegistry.counter("orders.created").increment() or meterRegistry.gauge("queue.size", queue, Queue::size). Micrometer supports counters, gauges, timers, and distribution summaries. These appear in /actuator/metrics and /actuator/prometheus automatically.

🎯 Key Takeaways

1/actuator/health is essential for Kubernetes liveness and readiness probes
2/actuator/prometheus enables Prometheus metrics scraping
3Only expose necessary endpoints — never /actuator/env or /actuator/heapdump publicly
4Secure Actuator endpoints with authentication or IP restriction
5Custom HealthIndicator for external dependency checks
6Liveness = restart if down; Readiness = remove from load balancer if down

🎯 Practice this topic in interviews

↗ Where this topic fits

Sources

Sources / References

Use these Spring Boot references to verify the concept in official docs and continue into the most relevant SplashRide pages.

Related SplashRide pages

SplashRide Spring Boot learning path

Browse the full Spring Boot topic collection and learning order on SplashRide.

Spring Boot Interview Prep

Practice Spring Boot interview questions and scenario-based answers.

Backend Engineer Career Path

A structured journey through Core Java, Spring Boot, production backend engineering, and interview preparation.

Full Stack Java Developer Career Path

A guided route through frontend foundations, Java backend engineering, delivery workflows, and interview readiness.

Monitoring

Implement production monitoring for Spring Boot applications — Micrometer metrics, Prometheus integration, Grafana dashboards, and distributed tracing with Micrometer Tracing.

Profiles

Master Spring Profiles for environment-specific configuration — separating dev, test, staging, and production settings without code changes.