Spring / Spring Boot 4 Basics Interview Questions
What is Spring Boot Actuator and what does it provide in Boot 4?
Spring Boot Actuator adds production-ready monitoring and management endpoints to any Spring Boot application. In Boot 4, the observability story has been tightened around OpenTelemetry with dedicated configuration properties.
| Endpoint | HTTP | What it shows |
|---|---|---|
| /actuator/health | GET | Application health status (UP/DOWN) and component health details |
| /actuator/info | GET | Application information (version, description, git commit) |
| /actuator/metrics | GET | Micrometer metrics (JVM, HTTP, database, custom) |
| /actuator/metrics/{name} | GET | Individual metric with tags |
| /actuator/env | GET | All environment properties and their sources |
| /actuator/beans | GET | All Spring beans in the context |
| /actuator/mappings | GET | All @RequestMapping routes |
| /actuator/loggers | GET/POST | Get and change log levels at runtime |
| /actuator/threaddump | GET | JVM thread dump |
| /actuator/httptrace | GET | Last 100 HTTP request/response traces |
# application.yml: Actuator configuration in Boot 4 management: endpoints: web: exposure: include: health,info,metrics,loggers # expose specific endpoints # include: "*" # expose all (not recommended in production) endpoint: health: show-details: when-authorized opentelemetry: # Boot 4: new OTel-specific config namespace resource-attributes: service.name: order-service service.version: "2.1.0" tracing: sampling: probability: 1.0 # 100% sampling in dev; reduce in prod # Custom health indicator: @Component public class DatabaseHealthIndicator implements HealthIndicator { @Override public Health health() { try { jdbcTemplate.queryForObject("SELECT 1", Integer.class); return Health.up() .withDetail("database", "reachable") .build(); } catch (Exception e) { return Health.down() .withDetail("error", e.getMessage()) .build(); } } }
More Related questions...