Spring Boot starter that provides comprehensive production-ready monitoring and management capabilities for applications
—
Spring Boot Actuator provides extensive configuration options through properties classes that control endpoint behavior, security, exposure, and transport-specific settings. All properties use the management.* prefix.
Configuration for HTTP-based actuator endpoints.
/**
* Configuration properties for web endpoints
*/
@ConfigurationProperties("management.endpoints.web")
public class WebEndpointProperties {
/**
* Base path for web endpoints (default: "/actuator")
*/
private String basePath = "/actuator";
/**
* Path mapping for individual endpoints
*/
private final PathMappingCache pathMapping = new PathMappingCache();
/**
* Endpoint exposure configuration
*/
private final Exposure exposure = new Exposure();
/**
* Discovery configuration for endpoint metadata
*/
private final Discovery discovery = new Discovery();
// Getters and setters
public String getBasePath() { return this.basePath; }
public void setBasePath(String basePath) { this.basePath = basePath; }
public PathMappingCache getPathMapping() { return this.pathMapping; }
public Exposure getExposure() { return this.exposure; }
public Discovery getDiscovery() { return this.discovery; }
/**
* Endpoint exposure configuration
*/
public static class Exposure {
/**
* Endpoint IDs to include (default: "health")
*/
private Set<String> include = new LinkedHashSet<>(Collections.singleton("health"));
/**
* Endpoint IDs to exclude
*/
private Set<String> exclude = new LinkedHashSet<>();
// Getters and setters
public Set<String> getInclude() { return this.include; }
public void setInclude(Set<String> include) { this.include = include; }
public Set<String> getExclude() { return this.exclude; }
public void setExclude(Set<String> exclude) { this.exclude = exclude; }
}
/**
* Discovery configuration for endpoint metadata
*/
public static class Discovery {
/**
* Whether endpoint discovery is enabled (default: true)
*/
private boolean enabled = true;
public boolean isEnabled() { return this.enabled; }
public void setEnabled(boolean enabled) { this.enabled = enabled; }
}
}Configuration for the health endpoint and health indicators.
/**
* Configuration properties for health endpoint
*/
@ConfigurationProperties("management.endpoint.health")
public class HealthEndpointProperties {
/**
* When to show health details
*/
private Show showDetails = Show.NEVER;
/**
* When to show health components
*/
private Show showComponents = Show.ALWAYS;
/**
* Roles required to show health details when showDetails is WHEN_AUTHORIZED
*/
private Set<String> roles = new LinkedHashSet<>();
/**
* Health group configurations
*/
private final Map<String, GroupProperties> group = new LinkedHashMap<>();
/**
* Logging configuration for health checks
*/
private final Logging logging = new Logging();
// Getters and setters
public Show getShowDetails() { return this.showDetails; }
public void setShowDetails(Show showDetails) { this.showDetails = showDetails; }
public Show getShowComponents() { return this.showComponents; }
public void setShowComponents(Show showComponents) { this.showComponents = showComponents; }
public Set<String> getRoles() { return this.roles; }
public void setRoles(Set<String> roles) { this.roles = roles; }
public Map<String, GroupProperties> getGroup() { return this.group; }
public Logging getLogging() { return this.logging; }
/**
* When to show health information
*/
public enum Show {
/**
* Never show details
*/
NEVER,
/**
* Show details when authorized
*/
WHEN_AUTHORIZED,
/**
* Always show details
*/
ALWAYS
}
/**
* Properties for health groups
*/
public static class GroupProperties {
/**
* Health indicators to include in this group
*/
private Set<String> include = new LinkedHashSet<>();
/**
* Health indicators to exclude from this group
*/
private Set<String> exclude = new LinkedHashSet<>();
/**
* When to show details for this group
*/
private Show showDetails;
/**
* When to show components for this group
*/
private Show showComponents;
/**
* Roles required for this group
*/
private Set<String> roles = new LinkedHashSet<>();
/**
* Additional properties for this group
*/
private final Map<String, Object> additionalProperties = new LinkedHashMap<>();
// Getters and setters...
}
/**
* Logging configuration for health checks
*/
public static class Logging {
/**
* Slow indicator threshold for logging warnings
*/
private Duration slowIndicatorThreshold = Duration.ofSeconds(10);
public Duration getSlowIndicatorThreshold() { return this.slowIndicatorThreshold; }
public void setSlowIndicatorThreshold(Duration threshold) { this.slowIndicatorThreshold = threshold; }
}
}Configuration for JMX-based actuator endpoints.
/**
* Configuration properties for JMX endpoints
*/
@ConfigurationProperties("management.endpoints.jmx")
public class JmxEndpointProperties {
/**
* Endpoints to expose over JMX
*/
private final Exposure exposure = new Exposure();
/**
* JMX domain name for endpoints
*/
private String domain = "org.springframework.boot";
/**
* Whether to ensure unique runtime object names
*/
private boolean uniqueNames = false;
/**
* Static properties to append to all object names
*/
private final Map<String, String> staticNames = new LinkedHashMap<>();
// Getters and setters
public Exposure getExposure() { return this.exposure; }
public String getDomain() { return this.domain; }
public void setDomain(String domain) { this.domain = domain; }
public boolean isUniqueNames() { return this.uniqueNames; }
public void setUniqueNames(boolean uniqueNames) { this.uniqueNames = uniqueNames; }
public Map<String, String> getStaticNames() { return this.staticNames; }
/**
* JMX endpoint exposure configuration
*/
public static class Exposure {
/**
* Endpoint IDs to include (default: all)
*/
private Set<String> include = new LinkedHashSet<>(Collections.singleton("*"));
/**
* Endpoint IDs to exclude
*/
private Set<String> exclude = new LinkedHashSet<>();
// Getters and setters...
}
}CORS configuration for web endpoints.
/**
* CORS configuration properties for web endpoints
*/
@ConfigurationProperties("management.endpoints.web.cors")
public class CorsEndpointProperties {
/**
* Comma-separated list of origins to allow
*/
private List<String> allowedOrigins = new ArrayList<>();
/**
* Comma-separated list of origin patterns to allow
*/
private List<String> allowedOriginPatterns = new ArrayList<>();
/**
* Comma-separated list of methods to allow
*/
private List<String> allowedMethods = new ArrayList<>();
/**
* Comma-separated list of headers to allow in a request
*/
private List<String> allowedHeaders = new ArrayList<>();
/**
* Comma-separated list of headers to include in a response
*/
private List<String> exposedHeaders = new ArrayList<>();
/**
* Whether credentials are supported
*/
private Boolean allowCredentials;
/**
* How long the response from a pre-flight request can be cached by clients
*/
private Duration maxAge = Duration.ofSeconds(1800);
// Getters and setters...
}Configuration for running management endpoints on a separate server.
/**
* Configuration properties for management server
*/
@ConfigurationProperties("management.server")
public class ManagementServerProperties {
/**
* Management endpoint port (uses main server port if not set)
*/
private Integer port;
/**
* Network address to which the management endpoints should bind
*/
private InetAddress address;
/**
* Management endpoint base path
*/
private String basePath = "";
/**
* SSL configuration for management server
*/
private final Ssl ssl = new Ssl();
// Getters and setters
public Integer getPort() { return this.port; }
public void setPort(Integer port) { this.port = port; }
public InetAddress getAddress() { return this.address; }
public void setAddress(InetAddress address) { this.address = address; }
public String getBasePath() { return this.basePath; }
public void setBasePath(String basePath) { this.basePath = basePath; }
public Ssl getSsl() { return this.ssl; }
/**
* SSL configuration for management server
*/
public static class Ssl {
/**
* Whether SSL is enabled for management server
*/
private boolean enabled = false;
/**
* Client authentication mode
*/
private ClientAuth clientAuth;
/**
* SSL bundle name to use
*/
private String bundle;
// Additional SSL properties...
}
}Configuration for metrics collection and export.
/**
* Configuration properties for metrics
*/
@ConfigurationProperties("management.metrics")
public class MetricsProperties {
/**
* Whether to enable metrics collection
*/
private boolean useGlobalRegistry = true;
/**
* Common tags to apply to all metrics
*/
private final Map<String, String> tags = new LinkedHashMap<>();
/**
* Metrics to enable/disable
*/
private final Map<String, Boolean> enable = new LinkedHashMap<>();
/**
* Distribution properties for timers and distribution summaries
*/
private final Distribution distribution = new Distribution();
/**
* Web metrics configuration
*/
private final Web web = new Web();
/**
* Export configuration for various monitoring systems
*/
private final Export export = new Export();
// Getters and setters...
/**
* Distribution configuration
*/
public static class Distribution {
/**
* Percentiles to compute and ship to monitoring systems
*/
private final Map<String, double[]> percentiles = new LinkedHashMap<>();
/**
* Service Level Objectives boundaries
*/
private final Map<String, Duration[]> slo = new LinkedHashMap<>();
/**
* Minimum expected value for distribution summaries and timers
*/
private final Map<String, Duration> minimumExpectedValue = new LinkedHashMap<>();
/**
* Maximum expected value for distribution summaries and timers
*/
private final Map<String, Duration> maximumExpectedValue = new LinkedHashMap<>();
// Getters and setters...
}
/**
* Web metrics configuration
*/
public static class Web {
/**
* Server metrics configuration
*/
private final Server server = new Server();
/**
* Client metrics configuration
*/
private final Client client = new Client();
// Getters and setters...
/**
* Server web metrics configuration
*/
public static class Server {
/**
* Auto-timing configuration for server requests
*/
private final Request request = new Request();
// Getters and setters...
/**
* Request auto-timing configuration
*/
public static class Request {
/**
* Auto-timing configuration
*/
private final AutoTimer autotime = new AutoTimer();
/**
* Maximum number of URI tags to allow
*/
private int maxUriTags = 100;
// Getters and setters...
}
}
}
/**
* Export configuration for monitoring systems
*/
public static class Export {
/**
* Prometheus export configuration
*/
private final Prometheus prometheus = new Prometheus();
// Other export configurations (datadog, influx, etc.)...
/**
* Prometheus export configuration
*/
public static class Prometheus {
/**
* Whether Prometheus export is enabled
*/
private boolean enabled = true;
/**
* Step size for Prometheus export
*/
private Duration step = Duration.ofMinutes(1);
/**
* Push gateway configuration
*/
private final Pushgateway pushgateway = new Pushgateway();
// Getters and setters...
/**
* Prometheus push gateway configuration
*/
public static class Pushgateway {
/**
* Whether push gateway is enabled
*/
private boolean enabled = false;
/**
* Base URL for push gateway
*/
private String baseUrl = "http://localhost:9091";
/**
* Job name for push gateway
*/
private String job;
/**
* Push interval
*/
private Duration pushRate = Duration.ofMinutes(1);
// Getters and setters...
}
}
}
}# Expose all endpoints over HTTP
management.endpoints.web.exposure.include=*
# Change actuator base path
management.endpoints.web.base-path=/manage
# Configure health endpoint
management.endpoint.health.show-details=always
management.endpoint.health.show-components=always
# Use separate port for management endpoints
management.server.port=8081
# Configure CORS
management.endpoints.web.cors.allowed-origins=http://localhost:3000
management.endpoints.web.cors.allowed-methods=GET,POST# Configure health groups
management.endpoint.health.group.liveness.include=livenessState,ping
management.endpoint.health.group.liveness.show-details=always
management.endpoint.health.group.readiness.include=readinessState,db,redis
management.endpoint.health.group.readiness.show-details=when-authorized
management.endpoint.health.group.readiness.roles=ADMIN,HEALTH_READER
# Configure slow indicator threshold
management.endpoint.health.logging.slow-indicator-threshold=5s# Enable all metrics
management.metrics.enable.all=true
# Add common tags
management.metrics.tags.application=my-app
management.metrics.tags.environment=production
management.metrics.tags.version=1.0.0
# Configure percentiles
management.metrics.distribution.percentiles.http.server.requests=0.5,0.95,0.99
management.metrics.distribution.slo.http.server.requests=50ms,100ms,200ms,500ms
# Configure Prometheus export
management.metrics.export.prometheus.enabled=true
management.endpoint.prometheus.enabled=true
# Configure push gateway
management.metrics.export.prometheus.pushgateway.enabled=true
management.metrics.export.prometheus.pushgateway.base-url=http://prometheus-pushgateway:9091
management.metrics.export.prometheus.pushgateway.job=spring-boot-app
management.metrics.export.prometheus.pushgateway.push-rate=30s# Restrict endpoint exposure
management.endpoints.web.exposure.include=health,info,metrics
management.endpoints.web.exposure.exclude=env,configprops
# Configure health details visibility
management.endpoint.health.show-details=when-authorized
management.endpoint.health.roles=ADMIN,ACTUATOR
# Disable sensitive endpoints
management.endpoint.shutdown.enabled=false
management.endpoint.env.enabled=false# Configure JMX domain
management.endpoints.jmx.domain=com.example.actuator
# Ensure unique JMX names
management.endpoints.jmx.unique-names=true
# Add static properties to JMX names
management.endpoints.jmx.static-names.application=MyApp
management.endpoints.jmx.static-names.environment=prod
# Configure JMX exposure
management.endpoints.jmx.exposure.include=health,info,metrics@Component
@ConfigurationProperties("management.endpoint.custom")
public class CustomEndpointProperties {
/**
* Whether the custom endpoint is enabled
*/
private boolean enabled = true;
/**
* Cache time-to-live for endpoint responses
*/
private Duration cacheTimeToLive = Duration.ofSeconds(0);
/**
* Custom configuration for the endpoint
*/
private String customProperty = "default-value";
// Getters and setters
public boolean isEnabled() { return this.enabled; }
public void setEnabled(boolean enabled) { this.enabled = enabled; }
public Duration getCacheTimeToLive() { return this.cacheTimeToLive; }
public void setCacheTimeToLive(Duration cacheTimeToLive) { this.cacheTimeToLive = cacheTimeToLive; }
public String getCustomProperty() { return this.customProperty; }
public void setCustomProperty(String customProperty) { this.customProperty = customProperty; }
}# application.yml
management:
endpoints:
web:
exposure:
include: "health,info"
endpoint:
health:
show-details: "never"
---
# application-dev.yml
spring:
config:
activate:
on-profile: "dev"
management:
endpoints:
web:
exposure:
include: "*"
endpoint:
health:
show-details: "always"
---
# application-prod.yml
spring:
config:
activate:
on-profile: "prod"
management:
server:
port: 8081
endpoints:
web:
exposure:
include: "health,info,metrics,prometheus"
endpoint:
health:
show-details: "when-authorized"
roles: ["ADMIN"]# Minimal exposure for production
management.endpoints.web.exposure.include=health,info,metrics,prometheus
management.endpoints.web.exposure.exclude=
# Secure health endpoint
management.endpoint.health.show-details=when-authorized
management.endpoint.health.roles=ACTUATOR_ADMIN
# Use separate management port
management.server.port=8081
management.server.address=127.0.0.1
# Disable dangerous endpoints
management.endpoint.shutdown.enabled=false
management.endpoint.env.post.enabled=false# Expose everything for development
management.endpoints.web.exposure.include=*
# Show all health details
management.endpoint.health.show-details=always
management.endpoint.health.show-components=always
# Enable useful endpoints
management.endpoint.shutdown.enabled=true
management.endpoint.env.post.enabled=true# Metrics for monitoring
management.metrics.enable.all=true
management.metrics.tags.service=my-service
management.metrics.tags.version=${spring.application.version:unknown}
# Prometheus integration
management.endpoint.prometheus.enabled=true
management.metrics.export.prometheus.enabled=true
# Health groups for Kubernetes
management.endpoint.health.group.liveness.include=livenessState
management.endpoint.health.group.readiness.include=readinessState,db,redisInstall with Tessl CLI
npx tessl i tessl/maven-org-springframework-boot--spring-boot-starter-actuator