DEV Community


Health Check with Java Spring easier than walking backwards

wakeupmh profile image Marcos Henrique ・2 min read

🚨 Direct to the point, the solution is Spring Actuator.

For this post I'll assume that you already familiarized with Spring Ecossystem, but if you aren't I recommends to you Marcos Maia's [post].

We have two ways to implement this little guy in our project:

  • Creating a Spring Boot application from zero;
  • Adding Spring Boot Actuator to an existing application;

Creating a Spring Boot application with Actuator

Let’s create a simple Spring Boot application with actuator dependency.

You can create the app using Spring Boot CLI like so:

spring init -d=web,actuator -n=actuator-demo actuator-demo

Another way would be generate the app from Spring Initializr website:

Adding Spring Boot Actuator to an existing application

You can add spring-boot-actuator module to an existing spring boot application using the following dependency.
If you are using maven:


For Gradle, add the dependency like this example bellow

dependencies {

Now let's check or verify the integrity of our API

Let’s explore the health endpoint by opening the http://localhost:<your port>/actuator/health URL.

The endpoint should display the following if everything goes well:

    "status": "UP"

The status will be UP as long as the application is healthy.

It will show DOWN if the application gets unhealthy due to any issue like connectivity with the database or lack of disk space etc.

But Spring Actuator is not limited to just that with it we can do Health check, Auditing, Metrics gathering and Monitoring, so it is a powerful tool for the general monitoring of our application and you can learn more about it here.

Thank you for your time and reading, until next time.


Editor guide