Spring Boot Actuator Interview Questions and Answers
Master Spring Boot Actuator with interview questions covering health checks, endpoints, metrics, Micrometer, Prometheus, custom endpoints, monitoring, Kubernetes readiness/liveness probes, and production best practices.
Introduction
Modern enterprise applications must be observable in production.
Operations teams need answers to questions like:
- Is the application healthy?
- How much memory is being used?
- What is the CPU usage?
- How many HTTP requests are received?
- Which endpoints are slow?
- Is the database available?
- Are Kafka and Redis connected?
Spring Boot Actuator provides production-ready monitoring and management capabilities through built-in endpoints.
Actuator is widely used with:
- Micrometer
- Prometheus
- Grafana
- ELK Stack
- Datadog
- Dynatrace
- Kubernetes
Spring Boot Observability Architecture
flowchart LR
Client --> SpringBootApp
SpringBootApp --> Actuator
Actuator --> Micrometer
Micrometer --> Prometheus
Prometheus --> Grafana
Actuator --> HealthEndpoint
Actuator --> MetricsEndpoint
Actuator --> InfoEndpoint
Q1. What is Spring Boot Actuator?
Answer
Spring Boot Actuator is a production-ready module that exposes application monitoring and management endpoints.
It provides information about:
- Health
- Metrics
- Environment
- Beans
- Mappings
- Configuration
- Loggers
- Thread Dumps
Dependency
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-actuator
</artifactId>
</dependency>
Q2. What are Actuator Endpoints?
Endpoints expose runtime information.
Common endpoints
| Endpoint | Purpose |
|---|---|
| /actuator/health | Application health |
| /actuator/info | Application information |
| /actuator/metrics | Performance metrics |
| /actuator/env | Environment properties |
| /actuator/beans | Spring beans |
| /actuator/mappings | REST mappings |
| /actuator/loggers | Logging levels |
| /actuator/prometheus | Prometheus metrics |
Architecture
flowchart TD
Actuator --> Health
Actuator --> Metrics
Actuator --> Beans
Actuator --> Loggers
Actuator --> Prometheus
Q3. What is the Health Endpoint?
The Health endpoint reports application status.
Example
GET
/actuator/health
Response
{
"status":"UP"
}
Health indicators include
- Database
- Redis
- Kafka
- RabbitMQ
- Disk Space
- Elasticsearch
Q4. What is Micrometer?
Micrometer is Spring Boot's metrics abstraction library.
It collects metrics from
- JVM
- CPU
- Memory
- HTTP Requests
- Database
- Cache
- Custom Metrics
Architecture
flowchart LR
Application --> Micrometer
Micrometer --> Prometheus
Micrometer --> Datadog
Micrometer --> CloudWatch
Micrometer --> Dynatrace
Micrometer allows one codebase to publish metrics to multiple monitoring systems.
Q5. What metrics does Actuator expose?
Common metrics
- JVM Memory
- CPU Usage
- Heap Usage
- Garbage Collection
- HTTP Requests
- Database Connections
- Thread Count
- Cache Statistics
Example
GET
/actuator/metrics
Retrieve a specific metric
/actuator/metrics/
jvm.memory.used
Q6. How does Prometheus integration work?
Spring Boot exposes metrics in Prometheus format.
Configuration
management.endpoints.web.exposure.include=
health,info,prometheus
Monitoring Flow
flowchart LR
SpringBoot --> Actuator
Actuator --> Prometheus
Prometheus --> Grafana
Grafana --> Dashboard
Prometheus periodically scrapes metrics from the application.
Q7. What are Custom Health Indicators?
Developers can implement custom health checks.
Example
@Component
public class PaymentHealthIndicator
implements HealthIndicator{
@Override
public Health health(){
return Health.up().build();
}
}
Typical custom checks
- Payment Gateway
- External REST API
- Banking Core System
- FTP Server
- Cloud Storage
Q8. How do Liveness and Readiness Probes work?
Spring Boot supports Kubernetes probes.
Endpoints
/actuator/health/liveness
/actuator/health/readiness
Kubernetes Flow
flowchart LR
Kubernetes --> ReadinessProbe
ReadinessProbe --> SpringBoot
SpringBoot --> Database
SpringBoot --> Kafka
SpringBoot --> Redis
Purpose
- Liveness determines whether the application should be restarted.
- Readiness determines whether the application is ready to receive traffic.
Q9. How do you secure Actuator Endpoints?
Never expose all endpoints publicly.
Example
management.endpoints.web.exposure.include=
health,info
Secure with Spring Security.
Typical production exposure
- health
- info
- prometheus
Restrict
- beans
- env
- mappings
- configprops
These endpoints may reveal sensitive information.
Q10. Actuator Best Practices
Enable Only Required Endpoints
Reduce attack surface.
Secure Management Endpoints
Require authentication for sensitive endpoints.
Use Micrometer
Collect standard and custom metrics.
Integrate with Prometheus
Use Grafana dashboards for visualization.
Monitor Business Metrics
Examples
- Payments Processed
- Failed Transactions
- Active Users
- Loan Requests
Banking Example
flowchart TD
BankingService --> Actuator
Actuator --> Health
Actuator --> Metrics
Actuator --> Prometheus
Prometheus --> Grafana
Grafana --> OperationsTeam
Operations teams monitor system health in real time.
Common Interview Questions
- What is Spring Boot Actuator?
- What are Actuator endpoints?
- What is the Health endpoint?
- What is Micrometer?
- How does Prometheus integration work?
- What metrics are available?
- What are Custom Health Indicators?
- What are Liveness and Readiness probes?
- How do you secure Actuator?
- Actuator best practices?
Quick Revision
| Topic | Summary |
|---|---|
| Actuator | Production monitoring module |
| Health | Application status |
| Metrics | JVM, HTTP, Database metrics |
| Micrometer | Metrics abstraction |
| Prometheus | Metrics collection |
| Grafana | Visualization |
| HealthIndicator | Custom health checks |
| Readiness | Ready for traffic |
| Liveness | Should application restart? |
| Security | Protect sensitive endpoints |
Actuator Request Lifecycle
sequenceDiagram
Prometheus->>Actuator: GET /actuator/prometheus
Actuator->>Micrometer: Collect Metrics
Micrometer-->>Actuator: Metrics
Actuator-->>Prometheus: Response
Prometheus->>Grafana: Store Metrics
Grafana-->>Operations Team: Dashboard
Production Example – Banking Payment Platform
A banking payment microservice processes 2 million transactions daily.
Production Monitoring Stack
- Spring Boot Actuator exposes health and metrics.
- Micrometer collects JVM, HTTP, HikariCP, and custom payment metrics.
- Prometheus scrapes
/actuator/prometheusevery 15 seconds. - Grafana displays dashboards for CPU usage, response times, throughput, and failed transactions.
- Kubernetes uses
/actuator/health/livenessand/actuator/health/readinessto manage container lifecycle. - Spring Security restricts access to management endpoints.
flowchart LR
SpringBootApp --> Actuator
Actuator --> Health
Actuator --> Metrics
Actuator --> Prometheus
Prometheus --> Grafana
Grafana --> DevOps
Kubernetes --> LivenessProbe
Kubernetes --> ReadinessProbe
This monitoring architecture enables operations teams to detect failures, analyze performance, and maintain high availability.
Key Takeaways
- Spring Boot Actuator provides production-ready monitoring and management endpoints.
- Built-in endpoints expose application health, metrics, environment details, bean information, mappings, and logging configuration.
- Micrometer serves as the metrics abstraction layer and integrates with monitoring systems such as Prometheus, Datadog, CloudWatch, and Dynatrace.
- Prometheus collects metrics, while Grafana visualizes them through dashboards.
- Custom HealthIndicator implementations allow applications to monitor external systems such as payment gateways and messaging platforms.
- Kubernetes uses Liveness and Readiness probes to determine application lifecycle and traffic routing.
- Only expose the endpoints required for production and secure sensitive endpoints using Spring Security.
- Combining Actuator with Micrometer, Prometheus, and Grafana provides complete observability for enterprise Spring Boot applications.