How to do it...

  1. The first thing that we need to do is add a dependency to the Spring Boot Actuator starter in our build.gradle file with the following content:
dependencies { 
    ... 
    compile("org.springframework.boot:spring-boot-starter-    data-rest") 
    // compile("org.springframework.boot:spring-boot-starter-    jetty") //       Need to use Jetty instead of Tomcat 
    compile("org.springframework.boot:spring-boot-starter-     actuator") 
    compile project(':db-count-starter') 
    ... 
} 
  1. Adding this dependency alone already gives us the ability to access the Spring management /actuator/* endpoints, such as /env, /info, /metrics, and /health, (though they are disabled by default, unless a management.endpoints.web.exposure.include=* property is configured in the application.properties ...

Get Developing Java Applications with Spring and Spring Boot now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.