Configuring Spring Boot Actuator

The Spring Boot Actuator module provides advanced production-ready features such as monitoring, metrics, health checks, etc. The Spring Boot Actuator enables you to monitor the application using HTTP endpoints and JMX. In this tutorial we will learn how to get started with it.

Configuring the Actuator in an application

In order to kick-start the Spring Boot Actuator it is sufficient to include the spring-boot-starter-actuator to autoconfigure Actuator. You can then take advantage of Actuator’s features in order to monitor a Spring Boot application:

$ spring init -dweb,actuator actuator-demo

Here is the list of dependencies from the pom.xml:


Now if you run the entry point class, you can check the metrics available:

$ mvn spring-boot:run

You should see from the Console logs the following entry:

2022-01-04 12:59:42.798  INFO 18424 --- [           main] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 1 endpoint(s) beneath base path '/actuator'

Default Endpoints available

Unlike in Spring Boot 1.x, Spring Boot 2 Actuator comes with most endpoints disabled, except for the health endpoint:

$ curl http://localhost:8080/actuator/health 

To check the list of available actuator endpoints, just point to the /actuator Root Context:

curl -s http://localhost:8080/actuator | jq
  "_links": {
    "self": {
      "href": "http://localhost:8080/actuator",
      "templated": false
    "health": {
      "href": "http://localhost:8080/actuator/health",
      "templated": false
    "health-path": {
      "href": "http://localhost:8080/actuator/health/{*path}",
      "templated": true

How to enable additional Actuator endpoints

In order to enable all the available Actuator endpoints you have to set the following property into the file:


As you can see from the Application Logs, now 15 endpoints are available:

INFO 11550 --- [           main] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 15 endpoint(s) beneath base path '/actuator' 

You can also explicitly enable/disable a specific endpoint (for example /beans), as follows:


To expose all enabled endpoints except one (for example /env), we use:


Configurable Endpoints

The following Actuator endpoints are autoconfigured by the Actuator starter with the default settings:

    • info: Displays arbitrary application info.
    • health: Shows application basic health info for unauthenticated users and full details for authenticated users.
    • beans: Shows a list of all Spring beans configured in the application.
    • autoconfig: Displays an autoconfiguration report showing all autoconfiguration candidates and the reason they were/were not applied.
    • mappings: Displays a collated list of all @RequestMapping paths.
    • configprops: Displays a collated list of all @ConfigurationProperties.
    • metrics: Shows metrics information for the current application.
    • env: Exposes properties from Spring’s ConfigurableEnvironment.
    • trace: Displays trace information (by default, the last 100 HTTP requests).
    • dump: Performs a thread dump.
    • loggers: Shows and modifies the configuration of loggers in the application.
    • auditevents: Exposes audit events information for the current application.
    • flyway: Shows any Flyway database migrations that have been applied.
    • liquibase: Shows any Liquibase database migrations that have been applied.
    • actuator: Provides a hypermedia-based “discovery page” for the other endpoints.
    • shutdown: Allows the application to be gracefully shut down (not enabled by default).

How to collect application metrics

You can collect metrics from the /metrics endpoint. When you request this endpoint, you will see the list of default metrics which you can query:

curl -s http://localhost:8080/actuator/metrics | jq
  "names": [
     . . . . . . . .

Then, you can query about detail for a specific metric. For example, if you want to check application metrics for http.server.request, then just add it at the end of the path:


Here are the metrics for the HTTP Endpoints:

spring boot actuator

From the output, you can see some basic statistics such as:

  • COUNT of HTTP requests
  • TOTAL_TIME spent in requests
  • MAX longest HTTP Request

How to customize the output of the actuator

You can also customize the data shown by the metrics. For example, if we want to customize the “/info”, we can modify the “” properties in Spring Sample Application is an example of Spring Boot Actuator 

This results in:

curl http://localhost:8080/actuator/info {"build":{"name":"Demo Spring Sample Application","description":"This is an example of Spring Boot Actuator","version":"1.0.0"}} 
Found the article helpful? if so please follow us on Socials
Twitter Icon       Facebook Icon       LinkedIn Icon       Mastodon Icon