1.

What is a Spring Boot Actuator? What are the features provided and how you can customize or add more?

Answer»

The ACTUATOR provides built-in features to your application which are production-ready. It provides web endpoints for each of this feature. Some of the most common Spring Boot Actuator endpoints:

  • /health: It shows application health INFORMATION.
  • /info: It shows arbitrary application info.
  • /metrics: It shows all metrics related information for the current application.
  • /trace: It shows trace information for last few HTTP requests.
  • /beans: It lists all Spring beans in your application.
  • /threaddump: Performs thread dump.
  • /env: Displays a list of properties in the current environment.

For example, when using MicroServices, you will definitely a health check for your microservice as your service registry/Load Balancer need to be updated with only LIVE or healthy services so that any incoming request to your application GOES to live node/server only. Instead of BUILDING your own health endpoint, you can just import the Spring Boot Actuator and use the built-in health endpoint.

If you need to your own health endpoint, you can do so by implementing health() method from org.springframework.boot.actuate.health.HealthIndicator.

To implement your own endpoint, you can implement org.springframework.boot.actuate.endpoint interface.

With Spring Boot Actuator 2.X, all endpoints except health and Info are disabled. To enable them you need to  set management.endpoints.web.exposure.include=*. 



Discussion

No Comment Found