Spring Boot Actuator
1. Introduction
Spring Boot Actuator is used for monitoring and managing applications.
It provides:
Application health status
Metrics and performance data
Internal system information
2. Why Use Actuator
Monitor application health
Reduce downtime
Improve performance
Track system behavior
Support production monitoring
3. Add Dependency
Maven
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>Gradle
implementation 'org.springframework.boot:spring-boot-starter-actuator'management.endpoints.web.base-path=/detailsEnable Specific Endpoint
management.endpoint.metrics.enabled=trueInclude Endpoints
management.endpoints.web.exposure.include=metrics,infoInclude All Endpoints
management.endpoints.web.exposure.include=*Exclude Endpoints
management.endpoints.web.exposure.exclude=info5. Common Actuator Endpoints
/actuator → List all endpoints
/actuator/health → Application health
/actuator/beans → All beans
/actuator/mappings → All request mappings
/actuator/metrics → Application metrics
6. Example Controller
@RestController
@RequestMapping("/get")
public class RESTfulController {
@Autowired
UserEntity entity;
@GetMapping("/data")
public UserEntity getEntity() {
return entity;
}
}7. Health Check Example
Open browser:
http://localhost:8080/actuator/healthOutput:
{
"status": "UP"
}8. Key Points
Only health endpoint is enabled by default
Other endpoints must be enabled manually
Can customize endpoint path
Useful for production monitoring
9. Security Note
Do not expose sensitive endpoints publicly
Secure endpoints using authentication
Use firewall or Spring Security
10. Conclusion
Actuator is essential for production applications
Helps monitor and manage system easily
Improves reliability and performance