Actuators in SpringBoot :

rajubora

rajubora

Posted on January 11, 2024

Actuators in SpringBoot :

Actuators are the list of endpoints which are provided by spring boot by default so that our applications has production ready features. the main benefit of actuators is that we can get production grade tool without having implement these features by ourselves .

To enable spring boot actuator , we need to add spring boot actuator dependency in
pom.xml :

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

also add configuration to application.property file:

management.endpoints.web.exposure.include=* 
Enter fullscreen mode Exit fullscreen mode

some of the endpoints :

/health - it summarizes the health status of application.
/loggers- it enables us to query and modify the logging level of
our application.
/env - returns the current enviroment property .
/info - returns general information.
/beans - returns all available beans in our BeanFactory.

There are many benefits of using actuators but main is that we can check the health of microservices .for example there is an order service and a discovery server. the server send message to the service in every T seconds to check wheather service is UP or Down . if it is UP then order service send status code 200 otherwise 500 or 503 .
here T seconds should be chosen in a such a manner so that the api calls should be minimum .

πŸ’– πŸ’ͺ πŸ™… 🚩
rajubora
rajubora

Posted on January 11, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related