March 5, 2020 | Spring boot complete tutorial with example | No Comments
We always need some tool that is used for monitoring our application. Spring boot provides Actuator for monitoring the application. It tells us the complete status of our application like status of our application, Information about our application, Beans detail of application and many more. We can see the actuator endPoint using hit the below URL
For using this actuator endPoint you have to add the below dependency in your pom.xml file.
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency>
Now run your application and hit the above given URL you will get the response like below:
By default only health and info end point are available using HTTP if you want to show all the endPoint using HTTP, you have to add below property in your application.properties file.
No hit the URL again now you will get the response like below:
By default if you hit the health or info URL it will give only specific information like below:
But if you want to see the complete health status and give information about your application using info endPoint you have to add the below property in your application.properties file.
management.endpoint.health.show-details=always info.appInformation.name=Spring Actuator Example info.appInformation.description=This is First Spring Boot Actuator Application Example info.appInformation.version=1.1.1
Now hit the /health and /info URL again you will get the response like below:
Spring boot Actuator provide /shutdown endPoint using which we can shutdown our application. This is a post request if you hit the /shutdown URL with POST method your application will shutdown and you will get the response like below:
We know by default all the actuator endPoints are available on /actuator endPoint but if we want to change this URL and port we have to add the below property in application.properties file:
Now our actuator endPoints are available on below URL:
Complete Code on GitHub: Actuator SpringBoot