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(); } } }
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
