Skip to content

Spring Boot Actuator

Karthik Pillai edited this page Sep 17, 2021 · 1 revision

Production-ready Features

Spring Boot includes a number of additional features to help you monitor and manage your application when you push it to production. You can choose to manage and monitor your application by using HTTP endpoints or with JMX. Auditing, health, and metrics gathering can also be automatically applied to your application.

1. Enabling Production-ready Features

The spring-boot-actuator module provides all of Spring Boot’s production-ready features. The recommended way to enable the features is to add a dependency on the spring-boot-starter-actuator ‘Starter’.

Definition of Actuator

An actuator is a manufacturing term that refers to a mechanical device for moving or controlling something. Actuators can generate a large amount of motion from a small change.

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-actuator'
}

2. Endpoints

Actuator endpoints let you monitor and interact with your application. Spring Boot includes a number of built-in endpoints and lets you add your own. For example, the health endpoint provides basic application health information.

Each individual endpoint can be enabled or disabled and exposed (made remotely accessible) over HTTP or JMX. An endpoint is considered to be available when it is both enabled and exposed. The built-in endpoints will only be auto-configured when they are available. Most applications choose exposure via HTTP, where the ID of the endpoint along with a prefix of /actuator is mapped to a URL. For example, by default, the health endpoint is mapped to /actuator/health.

The following technology-agnostic endpoints are available:

auditevents Exposes audit events information for the current application. Requires an AuditEventRepository bean.

beans Displays a complete list of all the Spring beans in your application.

caches Exposes available caches.

conditions Shows the conditions that were evaluated on configuration and auto-configuration classes and the reasons why they did or did not match.

configprops Displays a collated list of all @ConfigurationProperties.

env Exposes properties from Spring’s ConfigurableEnvironment.

flyway Shows any Flyway database migrations that have been applied. Requires one or more Flyway beans.

health Shows application health information.

httptrace Displays HTTP trace information (by default, the last 100 HTTP request-response exchanges). Requires an HttpTraceRepository bean.

info Displays arbitrary application info.

integrationgraph Shows the Spring Integration graph. Requires a dependency on spring-integration-core.

loggers Shows and modifies the configuration of loggers in the application.

liquibase Shows any Liquibase database migrations that have been applied. Requires one or more Liquibase beans.

metrics Shows ‘metrics’ information for the current application.

mappings Displays a collated list of all @RequestMapping paths.

quartz Shows information about Quartz Scheduler jobs.

scheduledtasks Displays the scheduled tasks in your application.

sessions Allows retrieval and deletion of user sessions from a Spring Session-backed session store. Requires a Servlet-based web application using Spring Session.

shutdown Lets the application be gracefully shutdown. Disabled by default.

startup Shows the startup steps data collected by the ApplicationStartup. Requires the SpringApplication to be configured with a BufferingApplicationStartup.

threaddump Performs a thread dump.

Clone this wiki locally