0
# Configuration Properties
1
2
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.
3
4
## Capabilities
5
6
### Web Endpoint Properties
7
8
Configuration for HTTP-based actuator endpoints.
9
10
```java { .api }
11
/**
12
* Configuration properties for web endpoints
13
*/
14
@ConfigurationProperties("management.endpoints.web")
15
public class WebEndpointProperties {
16
17
/**
18
* Base path for web endpoints (default: "/actuator")
19
*/
20
private String basePath = "/actuator";
21
22
/**
23
* Path mapping for individual endpoints
24
*/
25
private final PathMappingCache pathMapping = new PathMappingCache();
26
27
/**
28
* Endpoint exposure configuration
29
*/
30
private final Exposure exposure = new Exposure();
31
32
/**
33
* Discovery configuration for endpoint metadata
34
*/
35
private final Discovery discovery = new Discovery();
36
37
// Getters and setters
38
public String getBasePath() { return this.basePath; }
39
public void setBasePath(String basePath) { this.basePath = basePath; }
40
public PathMappingCache getPathMapping() { return this.pathMapping; }
41
public Exposure getExposure() { return this.exposure; }
42
public Discovery getDiscovery() { return this.discovery; }
43
44
/**
45
* Endpoint exposure configuration
46
*/
47
public static class Exposure {
48
/**
49
* Endpoint IDs to include (default: "health")
50
*/
51
private Set<String> include = new LinkedHashSet<>(Collections.singleton("health"));
52
53
/**
54
* Endpoint IDs to exclude
55
*/
56
private Set<String> exclude = new LinkedHashSet<>();
57
58
// Getters and setters
59
public Set<String> getInclude() { return this.include; }
60
public void setInclude(Set<String> include) { this.include = include; }
61
public Set<String> getExclude() { return this.exclude; }
62
public void setExclude(Set<String> exclude) { this.exclude = exclude; }
63
}
64
65
/**
66
* Discovery configuration for endpoint metadata
67
*/
68
public static class Discovery {
69
/**
70
* Whether endpoint discovery is enabled (default: true)
71
*/
72
private boolean enabled = true;
73
74
public boolean isEnabled() { return this.enabled; }
75
public void setEnabled(boolean enabled) { this.enabled = enabled; }
76
}
77
}
78
```
79
80
### Health Endpoint Properties
81
82
Configuration for the health endpoint and health indicators.
83
84
```java { .api }
85
/**
86
* Configuration properties for health endpoint
87
*/
88
@ConfigurationProperties("management.endpoint.health")
89
public class HealthEndpointProperties {
90
91
/**
92
* When to show health details
93
*/
94
private Show showDetails = Show.NEVER;
95
96
/**
97
* When to show health components
98
*/
99
private Show showComponents = Show.ALWAYS;
100
101
/**
102
* Roles required to show health details when showDetails is WHEN_AUTHORIZED
103
*/
104
private Set<String> roles = new LinkedHashSet<>();
105
106
/**
107
* Health group configurations
108
*/
109
private final Map<String, GroupProperties> group = new LinkedHashMap<>();
110
111
/**
112
* Logging configuration for health checks
113
*/
114
private final Logging logging = new Logging();
115
116
// Getters and setters
117
public Show getShowDetails() { return this.showDetails; }
118
public void setShowDetails(Show showDetails) { this.showDetails = showDetails; }
119
public Show getShowComponents() { return this.showComponents; }
120
public void setShowComponents(Show showComponents) { this.showComponents = showComponents; }
121
public Set<String> getRoles() { return this.roles; }
122
public void setRoles(Set<String> roles) { this.roles = roles; }
123
public Map<String, GroupProperties> getGroup() { return this.group; }
124
public Logging getLogging() { return this.logging; }
125
126
/**
127
* When to show health information
128
*/
129
public enum Show {
130
/**
131
* Never show details
132
*/
133
NEVER,
134
135
/**
136
* Show details when authorized
137
*/
138
WHEN_AUTHORIZED,
139
140
/**
141
* Always show details
142
*/
143
ALWAYS
144
}
145
146
/**
147
* Properties for health groups
148
*/
149
public static class GroupProperties {
150
/**
151
* Health indicators to include in this group
152
*/
153
private Set<String> include = new LinkedHashSet<>();
154
155
/**
156
* Health indicators to exclude from this group
157
*/
158
private Set<String> exclude = new LinkedHashSet<>();
159
160
/**
161
* When to show details for this group
162
*/
163
private Show showDetails;
164
165
/**
166
* When to show components for this group
167
*/
168
private Show showComponents;
169
170
/**
171
* Roles required for this group
172
*/
173
private Set<String> roles = new LinkedHashSet<>();
174
175
/**
176
* Additional properties for this group
177
*/
178
private final Map<String, Object> additionalProperties = new LinkedHashMap<>();
179
180
// Getters and setters...
181
}
182
183
/**
184
* Logging configuration for health checks
185
*/
186
public static class Logging {
187
/**
188
* Slow indicator threshold for logging warnings
189
*/
190
private Duration slowIndicatorThreshold = Duration.ofSeconds(10);
191
192
public Duration getSlowIndicatorThreshold() { return this.slowIndicatorThreshold; }
193
public void setSlowIndicatorThreshold(Duration threshold) { this.slowIndicatorThreshold = threshold; }
194
}
195
}
196
```
197
198
### JMX Endpoint Properties
199
200
Configuration for JMX-based actuator endpoints.
201
202
```java { .api }
203
/**
204
* Configuration properties for JMX endpoints
205
*/
206
@ConfigurationProperties("management.endpoints.jmx")
207
public class JmxEndpointProperties {
208
209
/**
210
* Endpoints to expose over JMX
211
*/
212
private final Exposure exposure = new Exposure();
213
214
/**
215
* JMX domain name for endpoints
216
*/
217
private String domain = "org.springframework.boot";
218
219
/**
220
* Whether to ensure unique runtime object names
221
*/
222
private boolean uniqueNames = false;
223
224
/**
225
* Static properties to append to all object names
226
*/
227
private final Map<String, String> staticNames = new LinkedHashMap<>();
228
229
// Getters and setters
230
public Exposure getExposure() { return this.exposure; }
231
public String getDomain() { return this.domain; }
232
public void setDomain(String domain) { this.domain = domain; }
233
public boolean isUniqueNames() { return this.uniqueNames; }
234
public void setUniqueNames(boolean uniqueNames) { this.uniqueNames = uniqueNames; }
235
public Map<String, String> getStaticNames() { return this.staticNames; }
236
237
/**
238
* JMX endpoint exposure configuration
239
*/
240
public static class Exposure {
241
/**
242
* Endpoint IDs to include (default: all)
243
*/
244
private Set<String> include = new LinkedHashSet<>(Collections.singleton("*"));
245
246
/**
247
* Endpoint IDs to exclude
248
*/
249
private Set<String> exclude = new LinkedHashSet<>();
250
251
// Getters and setters...
252
}
253
}
254
```
255
256
### CORS Endpoint Properties
257
258
CORS configuration for web endpoints.
259
260
```java { .api }
261
/**
262
* CORS configuration properties for web endpoints
263
*/
264
@ConfigurationProperties("management.endpoints.web.cors")
265
public class CorsEndpointProperties {
266
267
/**
268
* Comma-separated list of origins to allow
269
*/
270
private List<String> allowedOrigins = new ArrayList<>();
271
272
/**
273
* Comma-separated list of origin patterns to allow
274
*/
275
private List<String> allowedOriginPatterns = new ArrayList<>();
276
277
/**
278
* Comma-separated list of methods to allow
279
*/
280
private List<String> allowedMethods = new ArrayList<>();
281
282
/**
283
* Comma-separated list of headers to allow in a request
284
*/
285
private List<String> allowedHeaders = new ArrayList<>();
286
287
/**
288
* Comma-separated list of headers to include in a response
289
*/
290
private List<String> exposedHeaders = new ArrayList<>();
291
292
/**
293
* Whether credentials are supported
294
*/
295
private Boolean allowCredentials;
296
297
/**
298
* How long the response from a pre-flight request can be cached by clients
299
*/
300
private Duration maxAge = Duration.ofSeconds(1800);
301
302
// Getters and setters...
303
}
304
```
305
306
### Management Server Properties
307
308
Configuration for running management endpoints on a separate server.
309
310
```java { .api }
311
/**
312
* Configuration properties for management server
313
*/
314
@ConfigurationProperties("management.server")
315
public class ManagementServerProperties {
316
317
/**
318
* Management endpoint port (uses main server port if not set)
319
*/
320
private Integer port;
321
322
/**
323
* Network address to which the management endpoints should bind
324
*/
325
private InetAddress address;
326
327
/**
328
* Management endpoint base path
329
*/
330
private String basePath = "";
331
332
/**
333
* SSL configuration for management server
334
*/
335
private final Ssl ssl = new Ssl();
336
337
// Getters and setters
338
public Integer getPort() { return this.port; }
339
public void setPort(Integer port) { this.port = port; }
340
public InetAddress getAddress() { return this.address; }
341
public void setAddress(InetAddress address) { this.address = address; }
342
public String getBasePath() { return this.basePath; }
343
public void setBasePath(String basePath) { this.basePath = basePath; }
344
public Ssl getSsl() { return this.ssl; }
345
346
/**
347
* SSL configuration for management server
348
*/
349
public static class Ssl {
350
/**
351
* Whether SSL is enabled for management server
352
*/
353
private boolean enabled = false;
354
355
/**
356
* Client authentication mode
357
*/
358
private ClientAuth clientAuth;
359
360
/**
361
* SSL bundle name to use
362
*/
363
private String bundle;
364
365
// Additional SSL properties...
366
}
367
}
368
```
369
370
### Metrics Properties
371
372
Configuration for metrics collection and export.
373
374
```java { .api }
375
/**
376
* Configuration properties for metrics
377
*/
378
@ConfigurationProperties("management.metrics")
379
public class MetricsProperties {
380
381
/**
382
* Whether to enable metrics collection
383
*/
384
private boolean useGlobalRegistry = true;
385
386
/**
387
* Common tags to apply to all metrics
388
*/
389
private final Map<String, String> tags = new LinkedHashMap<>();
390
391
/**
392
* Metrics to enable/disable
393
*/
394
private final Map<String, Boolean> enable = new LinkedHashMap<>();
395
396
/**
397
* Distribution properties for timers and distribution summaries
398
*/
399
private final Distribution distribution = new Distribution();
400
401
/**
402
* Web metrics configuration
403
*/
404
private final Web web = new Web();
405
406
/**
407
* Export configuration for various monitoring systems
408
*/
409
private final Export export = new Export();
410
411
// Getters and setters...
412
413
/**
414
* Distribution configuration
415
*/
416
public static class Distribution {
417
/**
418
* Percentiles to compute and ship to monitoring systems
419
*/
420
private final Map<String, double[]> percentiles = new LinkedHashMap<>();
421
422
/**
423
* Service Level Objectives boundaries
424
*/
425
private final Map<String, Duration[]> slo = new LinkedHashMap<>();
426
427
/**
428
* Minimum expected value for distribution summaries and timers
429
*/
430
private final Map<String, Duration> minimumExpectedValue = new LinkedHashMap<>();
431
432
/**
433
* Maximum expected value for distribution summaries and timers
434
*/
435
private final Map<String, Duration> maximumExpectedValue = new LinkedHashMap<>();
436
437
// Getters and setters...
438
}
439
440
/**
441
* Web metrics configuration
442
*/
443
public static class Web {
444
/**
445
* Server metrics configuration
446
*/
447
private final Server server = new Server();
448
449
/**
450
* Client metrics configuration
451
*/
452
private final Client client = new Client();
453
454
// Getters and setters...
455
456
/**
457
* Server web metrics configuration
458
*/
459
public static class Server {
460
/**
461
* Auto-timing configuration for server requests
462
*/
463
private final Request request = new Request();
464
465
// Getters and setters...
466
467
/**
468
* Request auto-timing configuration
469
*/
470
public static class Request {
471
/**
472
* Auto-timing configuration
473
*/
474
private final AutoTimer autotime = new AutoTimer();
475
476
/**
477
* Maximum number of URI tags to allow
478
*/
479
private int maxUriTags = 100;
480
481
// Getters and setters...
482
}
483
}
484
}
485
486
/**
487
* Export configuration for monitoring systems
488
*/
489
public static class Export {
490
/**
491
* Prometheus export configuration
492
*/
493
private final Prometheus prometheus = new Prometheus();
494
495
// Other export configurations (datadog, influx, etc.)...
496
497
/**
498
* Prometheus export configuration
499
*/
500
public static class Prometheus {
501
/**
502
* Whether Prometheus export is enabled
503
*/
504
private boolean enabled = true;
505
506
/**
507
* Step size for Prometheus export
508
*/
509
private Duration step = Duration.ofMinutes(1);
510
511
/**
512
* Push gateway configuration
513
*/
514
private final Pushgateway pushgateway = new Pushgateway();
515
516
// Getters and setters...
517
518
/**
519
* Prometheus push gateway configuration
520
*/
521
public static class Pushgateway {
522
/**
523
* Whether push gateway is enabled
524
*/
525
private boolean enabled = false;
526
527
/**
528
* Base URL for push gateway
529
*/
530
private String baseUrl = "http://localhost:9091";
531
532
/**
533
* Job name for push gateway
534
*/
535
private String job;
536
537
/**
538
* Push interval
539
*/
540
private Duration pushRate = Duration.ofMinutes(1);
541
542
// Getters and setters...
543
}
544
}
545
}
546
}
547
```
548
549
## Usage Examples
550
551
### Basic Configuration
552
553
```properties
554
# Expose all endpoints over HTTP
555
management.endpoints.web.exposure.include=*
556
557
# Change actuator base path
558
management.endpoints.web.base-path=/manage
559
560
# Configure health endpoint
561
management.endpoint.health.show-details=always
562
management.endpoint.health.show-components=always
563
564
# Use separate port for management endpoints
565
management.server.port=8081
566
567
# Configure CORS
568
management.endpoints.web.cors.allowed-origins=http://localhost:3000
569
management.endpoints.web.cors.allowed-methods=GET,POST
570
```
571
572
### Advanced Health Configuration
573
574
```properties
575
# Configure health groups
576
management.endpoint.health.group.liveness.include=livenessState,ping
577
management.endpoint.health.group.liveness.show-details=always
578
579
management.endpoint.health.group.readiness.include=readinessState,db,redis
580
management.endpoint.health.group.readiness.show-details=when-authorized
581
management.endpoint.health.group.readiness.roles=ADMIN,HEALTH_READER
582
583
# Configure slow indicator threshold
584
management.endpoint.health.logging.slow-indicator-threshold=5s
585
```
586
587
### Metrics Configuration
588
589
```properties
590
# Enable all metrics
591
management.metrics.enable.all=true
592
593
# Add common tags
594
management.metrics.tags.application=my-app
595
management.metrics.tags.environment=production
596
management.metrics.tags.version=1.0.0
597
598
# Configure percentiles
599
management.metrics.distribution.percentiles.http.server.requests=0.5,0.95,0.99
600
management.metrics.distribution.slo.http.server.requests=50ms,100ms,200ms,500ms
601
602
# Configure Prometheus export
603
management.metrics.export.prometheus.enabled=true
604
management.endpoint.prometheus.enabled=true
605
606
# Configure push gateway
607
management.metrics.export.prometheus.pushgateway.enabled=true
608
management.metrics.export.prometheus.pushgateway.base-url=http://prometheus-pushgateway:9091
609
management.metrics.export.prometheus.pushgateway.job=spring-boot-app
610
management.metrics.export.prometheus.pushgateway.push-rate=30s
611
```
612
613
### Security Configuration
614
615
```properties
616
# Restrict endpoint exposure
617
management.endpoints.web.exposure.include=health,info,metrics
618
management.endpoints.web.exposure.exclude=env,configprops
619
620
# Configure health details visibility
621
management.endpoint.health.show-details=when-authorized
622
management.endpoint.health.roles=ADMIN,ACTUATOR
623
624
# Disable sensitive endpoints
625
management.endpoint.shutdown.enabled=false
626
management.endpoint.env.enabled=false
627
```
628
629
### JMX Configuration
630
631
```properties
632
# Configure JMX domain
633
management.endpoints.jmx.domain=com.example.actuator
634
635
# Ensure unique JMX names
636
management.endpoints.jmx.unique-names=true
637
638
# Add static properties to JMX names
639
management.endpoints.jmx.static-names.application=MyApp
640
management.endpoints.jmx.static-names.environment=prod
641
642
# Configure JMX exposure
643
management.endpoints.jmx.exposure.include=health,info,metrics
644
```
645
646
### Custom Endpoint Properties
647
648
```java
649
@Component
650
@ConfigurationProperties("management.endpoint.custom")
651
public class CustomEndpointProperties {
652
653
/**
654
* Whether the custom endpoint is enabled
655
*/
656
private boolean enabled = true;
657
658
/**
659
* Cache time-to-live for endpoint responses
660
*/
661
private Duration cacheTimeToLive = Duration.ofSeconds(0);
662
663
/**
664
* Custom configuration for the endpoint
665
*/
666
private String customProperty = "default-value";
667
668
// Getters and setters
669
public boolean isEnabled() { return this.enabled; }
670
public void setEnabled(boolean enabled) { this.enabled = enabled; }
671
public Duration getCacheTimeToLive() { return this.cacheTimeToLive; }
672
public void setCacheTimeToLive(Duration cacheTimeToLive) { this.cacheTimeToLive = cacheTimeToLive; }
673
public String getCustomProperty() { return this.customProperty; }
674
public void setCustomProperty(String customProperty) { this.customProperty = customProperty; }
675
}
676
```
677
678
### Environment-Specific Configuration
679
680
```yaml
681
# application.yml
682
management:
683
endpoints:
684
web:
685
exposure:
686
include: "health,info"
687
endpoint:
688
health:
689
show-details: "never"
690
691
---
692
# application-dev.yml
693
spring:
694
config:
695
activate:
696
on-profile: "dev"
697
management:
698
endpoints:
699
web:
700
exposure:
701
include: "*"
702
endpoint:
703
health:
704
show-details: "always"
705
706
---
707
# application-prod.yml
708
spring:
709
config:
710
activate:
711
on-profile: "prod"
712
management:
713
server:
714
port: 8081
715
endpoints:
716
web:
717
exposure:
718
include: "health,info,metrics,prometheus"
719
endpoint:
720
health:
721
show-details: "when-authorized"
722
roles: ["ADMIN"]
723
```
724
725
## Common Configuration Patterns
726
727
### Production Security Setup
728
729
```properties
730
# Minimal exposure for production
731
management.endpoints.web.exposure.include=health,info,metrics,prometheus
732
management.endpoints.web.exposure.exclude=
733
734
# Secure health endpoint
735
management.endpoint.health.show-details=when-authorized
736
management.endpoint.health.roles=ACTUATOR_ADMIN
737
738
# Use separate management port
739
management.server.port=8081
740
management.server.address=127.0.0.1
741
742
# Disable dangerous endpoints
743
management.endpoint.shutdown.enabled=false
744
management.endpoint.env.post.enabled=false
745
```
746
747
### Development Convenience Setup
748
749
```properties
750
# Expose everything for development
751
management.endpoints.web.exposure.include=*
752
753
# Show all health details
754
management.endpoint.health.show-details=always
755
management.endpoint.health.show-components=always
756
757
# Enable useful endpoints
758
management.endpoint.shutdown.enabled=true
759
management.endpoint.env.post.enabled=true
760
```
761
762
### Monitoring Integration Setup
763
764
```properties
765
# Metrics for monitoring
766
management.metrics.enable.all=true
767
management.metrics.tags.service=my-service
768
management.metrics.tags.version=${spring.application.version:unknown}
769
770
# Prometheus integration
771
management.endpoint.prometheus.enabled=true
772
management.metrics.export.prometheus.enabled=true
773
774
# Health groups for Kubernetes
775
management.endpoint.health.group.liveness.include=livenessState
776
management.endpoint.health.group.readiness.include=readinessState,db,redis
777
```