Implement liveness and readiness health checks in Spring Boot to protect production deployments and traffic routing.
On this page
Why Health Checks Are Deployment Control
Health checks decide:
- whether traffic reaches your service
- whether a pod is restarted
- whether rolling deploys are safe
Misconfigured health checks cause outages.
Liveness vs Readiness
Liveness:
Is the process alive?
Readiness:
Is the service ready to accept traffic?
If readiness is true while DB is down, traffic hits a broken service.
Dependency Checks
Readiness should reflect critical dependencies:
- database connectivity
- message broker
- essential downstream APIs
Non-critical dependencies should not fail readiness.
Checklist
- Separate liveness and readiness
- Fail readiness during shutdown
- Check only critical dependencies
- Avoid expensive health checks
- Test behavior under dependency failure
Health checks protect rolling deploys from self-inflicted outages.