Spring Boot starter that provides comprehensive production-ready monitoring and management capabilities for applications
—
Spring Boot Actuator provides numerous production-ready endpoints out of the box for monitoring, management, and diagnostics. These endpoints expose operational information about the running application and can be accessed via HTTP or JMX.
Provides application health information with support for custom health indicators.
/**
* Endpoint for application health information
*/
@Endpoint(id = "health")
public class HealthEndpoint {
/**
* Get overall application health
* @return the health information
*/
@ReadOperation
public HealthComponent health() { /* ... */ }
/**
* Get health for a specific path
* @param path the health path segments
* @return the health information for the path
*/
@ReadOperation
public HealthComponent healthForPath(@Selector String... path) { /* ... */ }
}Exposes arbitrary application information contributed by InfoContributor beans.
/**
* Endpoint for application information
*/
@Endpoint(id = "info")
public class InfoEndpoint {
/**
* Get application information
* @return the application information
*/
@ReadOperation
public Map<String, Object> info() { /* ... */ }
}Provides access to application metrics collected by Micrometer.
/**
* Endpoint for application metrics
*/
@Endpoint(id = "metrics")
public class MetricsEndpoint {
/**
* List all available metric names
* @return response containing metric names
*/
@ReadOperation
public ListNamesResponse listNames() { /* ... */ }
/**
* Get metric details for a specific metric
* @param requiredMetricName the metric name
* @param tag optional tag filters
* @return the metric response
*/
@ReadOperation
public MetricResponse metric(@Selector String requiredMetricName,
@Nullable List<String> tag) { /* ... */ }
/**
* Response containing available metric names
*/
public static final class ListNamesResponse {
private final Set<String> names;
public Set<String> getNames() { return this.names; }
}
/**
* Response containing metric details
*/
public static final class MetricResponse {
private final String name;
private final String description;
private final String baseUnit;
private final List<Sample> measurements;
private final List<AvailableTag> availableTags;
// Getters...
}
}Exposes properties from the Spring Environment including configuration properties.
/**
* Endpoint for environment properties
*/
@Endpoint(id = "env")
public class EnvironmentEndpoint {
/**
* Get all environment information
* @return the environment descriptor
*/
@ReadOperation
public EnvironmentDescriptor environment() { /* ... */ }
/**
* Get environment information for a specific property
* @param toMatch the property name pattern
* @return the environment entry descriptor
*/
@ReadOperation
public EnvironmentEntryDescriptor environmentEntry(@Selector String toMatch) { /* ... */ }
/**
* Set an environment property (if enabled)
* @param toMatch the property name
* @param value the property value
* @return the property descriptor
*/
@WriteOperation
public PropertyDescriptor setProperty(@Selector String toMatch,
@Nullable String value) { /* ... */ }
/**
* Delete an environment property (if enabled)
* @param toMatch the property name
* @return the property descriptor
*/
@DeleteOperation
public PropertyDescriptor deleteProperty(@Selector String toMatch) { /* ... */ }
}Shows all @ConfigurationProperties beans and their current values.
/**
* Endpoint for configuration properties report
*/
@Endpoint(id = "configprops")
public class ConfigurationPropertiesReportEndpoint {
/**
* Get configuration properties report
* @return the configuration properties report
*/
@ReadOperation
public ConfigurationPropertiesReport configurationProperties() { /* ... */ }
/**
* Get configuration properties for a specific bean
* @param beanName the bean name
* @return the configuration properties bean
*/
@ReadOperation
public ConfigurationPropertiesBean configurationPropertiesBean(@Selector String beanName) { /* ... */ }
}Lists all Spring beans in the application context.
/**
* Endpoint for Spring beans information
*/
@Endpoint(id = "beans")
public class BeansEndpoint {
/**
* Get information about all Spring beans
* @return the beans report
*/
@ReadOperation
public BeansReport beans() { /* ... */ }
/**
* Describes Spring beans
*/
public static final class BeansReport {
private final Map<String, ContextBeans> contexts;
public Map<String, ContextBeans> getContexts() { return this.contexts; }
}
}Manages logger levels at runtime, allowing dynamic log level changes.
/**
* Endpoint for logger configuration
*/
@Endpoint(id = "loggers")
public class LoggersEndpoint {
/**
* Get all logger configurations
* @return the loggers report
*/
@ReadOperation
public LoggersReport loggers() { /* ... */ }
/**
* Get configuration for a specific logger
* @param name the logger name
* @return the logger configuration
*/
@ReadOperation
public LoggerConfiguration loggerConfiguration(@Selector String name) { /* ... */ }
/**
* Set logger level
* @param name the logger name
* @param configuredLevel the level to set
*/
@WriteOperation
public void configureLogLevel(@Selector String name,
@Nullable LogLevel configuredLevel) { /* ... */ }
}Shows information about scheduled tasks in the application.
/**
* Endpoint for scheduled tasks information
*/
@Endpoint(id = "scheduledtasks")
public class ScheduledTasksEndpoint {
/**
* Get scheduled tasks report
* @return the scheduled tasks report
*/
@ReadOperation
public ScheduledTasksReport scheduledTasks() { /* ... */ }
}Allows graceful shutdown of the application (disabled by default).
/**
* Endpoint for application shutdown
*/
@Endpoint(id = "shutdown", defaultAccess = Access.RESTRICTED)
public class ShutdownEndpoint {
/**
* Shutdown the application
* @return shutdown confirmation message
*/
@WriteOperation
public Map<String, String> shutdown() { /* ... */ }
}Provides thread dump information for diagnostics.
/**
* Endpoint for thread dump information
*/
@Endpoint(id = "threaddump")
public class ThreadDumpEndpoint {
/**
* Get thread dump
* @return the thread dump
*/
@ReadOperation
public ThreadDumpDescriptor threadDump() { /* ... */ }
}Web-specific endpoint for downloading heap dumps.
/**
* Web endpoint for heap dump download
*/
@EndpointWebExtension(endpoint = HeapDumpEndpoint.class)
public class HeapDumpWebEndpoint {
/**
* Download heap dump
* @return heap dump as Resource
*/
@ReadOperation(produces = "application/octet-stream")
public Resource heapDump() { /* ... */ }
}Exposes audit events for security monitoring.
/**
* Endpoint for audit events
*/
@Endpoint(id = "auditevents")
public class AuditEventsEndpoint {
/**
* Get audit events
* @param after events after this date
* @param principal filter by principal
* @param type filter by event type
* @return the audit events report
*/
@ReadOperation
public AuditEventsDescriptor auditEvents(@Nullable OffsetDateTime after,
@Nullable String principal,
@Nullable String type) { /* ... */ }
}Information about Flyway database migrations.
/**
* Endpoint for Flyway migration information
*/
@Endpoint(id = "flyway")
public class FlywayEndpoint {
/**
* Get Flyway migration information
* @return the Flyway report
*/
@ReadOperation
public FlywayReport flyway() { /* ... */ }
/**
* Get Flyway information for a specific context
* @param name the context name
* @return the Flyway context
*/
@ReadOperation
public FlywayContext flywayByName(@Selector String name) { /* ... */ }
}Information about Liquibase database changesets.
/**
* Endpoint for Liquibase changelog information
*/
@Endpoint(id = "liquibase")
public class LiquibaseEndpoint {
/**
* Get Liquibase changelog information
* @return the Liquibase report
*/
@ReadOperation
public LiquibaseReport liquibase() { /* ... */ }
/**
* Get Liquibase information for a specific context
* @param name the context name
* @return the Liquibase context
*/
@ReadOperation
public LiquibaseContext liquibaseByName(@Selector String name) { /* ... */ }
}Information about Quartz scheduler jobs and triggers.
/**
* Endpoint for Quartz scheduler information
*/
@Endpoint(id = "quartz")
public class QuartzEndpoint {
/**
* Get Quartz scheduler report
* @return the Quartz report
*/
@ReadOperation
public QuartzReport quartz() { /* ... */ }
/**
* Get job details
* @param group the job group
* @param name the job name
* @return the job details
*/
@ReadOperation
public QuartzJobDetails quartzJob(@Selector String group,
@Selector String name) { /* ... */ }
/**
* Get trigger details
* @param group the trigger group
* @param name the trigger name
* @return the trigger details
*/
@ReadOperation
public QuartzTriggerDetails quartzTrigger(@Selector String group,
@Selector String name) { /* ... */ }
}Spring Integration message flow visualization.
/**
* Endpoint for Spring Integration graph
*/
@Endpoint(id = "integrationgraph")
public class IntegrationGraphEndpoint {
/**
* Get integration graph
* @return the integration graph
*/
@ReadOperation
public Map<String, Object> graph() { /* ... */ }
/**
* Rebuild the integration graph
* @return rebuild confirmation
*/
@WriteOperation
public Map<String, Object> rebuild() { /* ... */ }
}Software Bill of Materials information.
/**
* Endpoint for Software Bill of Materials
*/
@Endpoint(id = "sbom")
public class SbomEndpoint {
/**
* Get SBOM information
* @return the SBOM report
*/
@ReadOperation
public SbomReport sbom() { /* ... */ }
/**
* Get SBOM for a specific ID
* @param id the SBOM ID
* @return the SBOM details
*/
@ReadOperation
public Object sbomById(@Selector String id) { /* ... */ }
}# Health check
curl http://localhost:8080/actuator/health
# Application info
curl http://localhost:8080/actuator/info
# All available metrics
curl http://localhost:8080/actuator/metrics
# Specific metric
curl http://localhost:8080/actuator/metrics/jvm.memory.used
# Environment properties
curl http://localhost:8080/actuator/env
# Specific property
curl http://localhost:8080/actuator/env/server.port
# Logger levels
curl http://localhost:8080/actuator/loggers
# Change logger level
curl -X POST http://localhost:8080/actuator/loggers/com.example \
-H 'Content-Type: application/json' \
-d '{"configuredLevel": "DEBUG"}'@RestController
public class ManagementController {
private final HealthEndpoint healthEndpoint;
private final MetricsEndpoint metricsEndpoint;
public ManagementController(HealthEndpoint healthEndpoint,
MetricsEndpoint metricsEndpoint) {
this.healthEndpoint = healthEndpoint;
this.metricsEndpoint = metricsEndpoint;
}
@GetMapping("/custom-health")
public HealthComponent getHealth() {
return healthEndpoint.health();
}
@GetMapping("/memory-metrics")
public MetricsEndpoint.MetricResponse getMemoryMetrics() {
return metricsEndpoint.metric("jvm.memory.used", List.of("area:heap"));
}
}Built-in endpoints can be configured through application properties:
# Expose specific endpoints
management.endpoints.web.exposure.include=health,info,metrics,loggers
# Expose all endpoints (not recommended for production)
management.endpoints.web.exposure.include=*
# Exclude specific endpoints
management.endpoints.web.exposure.exclude=env,configprops
# Enable shutdown endpoint (disabled by default)
management.endpoint.shutdown.enabled=true
# Configure health endpoint
management.endpoint.health.show-details=when-authorized
management.endpoint.health.show-components=always
# Configure info endpoint
management.info.build.enabled=true
management.info.git.enabled=true
management.info.java.enabled=true
# Configure metrics endpoint
management.endpoint.metrics.enabled=true
# Enable environment endpoint write operations
management.endpoint.env.post.enabled=true
# Configure loggers endpoint
management.endpoint.loggers.enabled=true
# Change base path
management.endpoints.web.base-path=/manage
# Use different port for management endpoints
management.server.port=8081Many built-in endpoints expose sensitive information:
Ensure proper security configuration:
# Restrict sensitive endpoints
management.endpoint.env.enabled=false
management.endpoint.configprops.enabled=false
management.endpoint.shutdown.enabled=false
# Or secure them with Spring Security
management.endpoints.web.exposure.include=*
# Configure Spring Security to protect /actuator/** endpointsInstall with Tessl CLI
npx tessl i tessl/maven-org-springframework-boot--spring-boot-starter-actuator