0
# Built-in Endpoints
1
2
Spring Boot Actuator provides a comprehensive set of pre-built endpoints for application management including beans, environment, configuration properties, thread dumps, heap dumps, and more.
3
4
## Capabilities
5
6
### Application Context Endpoints
7
8
Endpoints for inspecting the Spring application context and its components.
9
10
```java { .api }
11
/**
12
* Endpoint that exposes details of application context beans
13
*/
14
@Endpoint(id = "beans")
15
public class BeansEndpoint {
16
public BeansEndpoint(ConfigurableApplicationContext context);
17
18
@ReadOperation
19
public ApplicationBeans beans();
20
21
/**
22
* Description of application beans
23
*/
24
public static final class ApplicationBeans {
25
public Map<String, ContextBeans> getContexts();
26
27
public static final class ContextBeans {
28
public Map<String, BeanDescriptor> getBeans();
29
public String getParentId();
30
31
public static final class BeanDescriptor {
32
public Set<String> getAliases();
33
public String getScope();
34
public String getType();
35
public String getResource();
36
public Set<String> getDependencies();
37
}
38
}
39
}
40
}
41
42
/**
43
* Endpoint that exposes configuration properties
44
*/
45
@Endpoint(id = "configprops")
46
public class ConfigurationPropertiesEndpoint {
47
public ConfigurationPropertiesEndpoint(ConfigurationPropertiesDescriptor descriptor,
48
ConfigurationPropertiesBeanDescriptor descriptor);
49
50
@ReadOperation
51
public ApplicationConfigurationProperties configurationProperties();
52
53
@ReadOperation
54
public ConfigurationPropertiesBeanDescriptor configurationPropertiesWithPrefix(@Selector String prefix);
55
}
56
57
/**
58
* Endpoint that exposes auto-configuration conditions
59
*/
60
@Endpoint(id = "conditions")
61
public class ConditionsEndpoint {
62
public ConditionsEndpoint(ConfigurableApplicationContext context);
63
64
@ReadOperation
65
public ApplicationConditionEvaluation conditions();
66
67
public static final class ApplicationConditionEvaluation {
68
public Map<String, ContextConditionEvaluation> getContexts();
69
70
public static final class ContextConditionEvaluation {
71
public Map<String, ConditionEvaluation> getPositiveMatches();
72
public Map<String, ConditionEvaluation> getNegativeMatches();
73
public Set<String> getExclusions();
74
public Set<String> getUnconditionalClasses();
75
}
76
}
77
}
78
```
79
80
**Usage Example:**
81
82
```java
83
@RestController
84
public class ApplicationContextController {
85
86
private final BeansEndpoint beansEndpoint;
87
private final ConfigurationPropertiesEndpoint configPropsEndpoint;
88
89
public ApplicationContextController(BeansEndpoint beansEndpoint,
90
ConfigurationPropertiesEndpoint configPropsEndpoint) {
91
this.beansEndpoint = beansEndpoint;
92
this.configPropsEndpoint = configPropsEndpoint;
93
}
94
95
@GetMapping("/admin/context/beans")
96
public ResponseEntity<?> getApplicationBeans() {
97
return ResponseEntity.ok(beansEndpoint.beans());
98
}
99
100
@GetMapping("/admin/context/config")
101
public ResponseEntity<?> getConfigurationProperties() {
102
return ResponseEntity.ok(configPropsEndpoint.configurationProperties());
103
}
104
}
105
```
106
107
### Environment and Properties Endpoints
108
109
Endpoints for inspecting environment variables and application properties.
110
111
```java { .api }
112
/**
113
* Endpoint to expose Environment information
114
*/
115
@Endpoint(id = "env")
116
public class EnvironmentEndpoint {
117
public EnvironmentEndpoint(Environment environment, List<Sanitizer> sanitizers);
118
119
@ReadOperation
120
public EnvironmentDescriptor environment(@Nullable String pattern);
121
122
@ReadOperation
123
public EnvironmentEntryDescriptor environmentEntry(@Selector String toMatch);
124
125
/**
126
* Description of the environment
127
*/
128
public static final class EnvironmentDescriptor {
129
public Set<String> getActiveProfiles();
130
public List<PropertySourceDescriptor> getPropertySources();
131
132
public static final class PropertySourceDescriptor {
133
public String getName();
134
public Map<String, PropertyValueDescriptor> getProperties();
135
136
public static final class PropertyValueDescriptor {
137
public Object getValue();
138
public String getOrigin();
139
}
140
}
141
}
142
143
/**
144
* Description of a single environment entry
145
*/
146
public static final class EnvironmentEntryDescriptor {
147
public PropertySourceDescriptor getProperty();
148
public List<PropertySourceDescriptor> getPropertySources();
149
}
150
}
151
```
152
153
**Usage Example:**
154
155
```java
156
@Service
157
public class EnvironmentInspectionService {
158
159
private final EnvironmentEndpoint environmentEndpoint;
160
161
public EnvironmentInspectionService(EnvironmentEndpoint environmentEndpoint) {
162
this.environmentEndpoint = environmentEndpoint;
163
}
164
165
public Map<String, Object> getApplicationProperties() {
166
EnvironmentDescriptor env = environmentEndpoint.environment("application.*");
167
return extractPropertiesFromDescriptor(env);
168
}
169
170
public Object getSpecificProperty(String propertyName) {
171
EnvironmentEntryDescriptor entry = environmentEndpoint.environmentEntry(propertyName);
172
return entry.getProperty().getProperties().get(propertyName).getValue();
173
}
174
}
175
```
176
177
### System Diagnostic Endpoints
178
179
Endpoints for system-level diagnostics and monitoring.
180
181
```java { .api }
182
/**
183
* Endpoint to expose thread dump information
184
*/
185
@Endpoint(id = "threaddump")
186
public class ThreadDumpEndpoint {
187
@ReadOperation
188
public ThreadDumpDescriptor threadDump();
189
190
/**
191
* Description of thread dump
192
*/
193
public static final class ThreadDumpDescriptor {
194
public List<ThreadDescriptor> getThreads();
195
196
public static final class ThreadDescriptor {
197
public String getThreadName();
198
public long getThreadId();
199
public String getThreadState();
200
public String getBlockedTime();
201
public String getWaitedTime();
202
public String getLockName();
203
public String getLockOwnerName();
204
public Long getLockOwnerId();
205
public boolean isDaemon();
206
public boolean isInNative();
207
public boolean isSuspended();
208
public StackTraceElement[] getStackTrace();
209
public List<MonitorInfoDescriptor> getLockedMonitors();
210
public List<LockInfoDescriptor> getLockedSynchronizers();
211
}
212
}
213
}
214
215
/**
216
* Endpoint to generate heap dump
217
*/
218
@Endpoint(id = "heapdump")
219
public class HeapDumpEndpoint {
220
@ReadOperation
221
public WebEndpointResponse<Resource> heapDump();
222
}
223
224
/**
225
* Endpoint for graceful shutdown
226
*/
227
@Endpoint(id = "shutdown")
228
public class ShutdownEndpoint {
229
public ShutdownEndpoint(ConfigurableApplicationContext context);
230
231
@WriteOperation
232
public Map<String, String> shutdown();
233
}
234
```
235
236
**Usage Example:**
237
238
```java
239
@Component
240
public class SystemDiagnosticsService {
241
242
private final ThreadDumpEndpoint threadDumpEndpoint;
243
private final HeapDumpEndpoint heapDumpEndpoint;
244
245
public SystemDiagnosticsService(ThreadDumpEndpoint threadDumpEndpoint,
246
HeapDumpEndpoint heapDumpEndpoint) {
247
this.threadDumpEndpoint = threadDumpEndpoint;
248
this.heapDumpEndpoint = heapDumpEndpoint;
249
}
250
251
public void analyzeThreads() {
252
ThreadDumpDescriptor threadDump = threadDumpEndpoint.threadDump();
253
254
List<ThreadDescriptor> blockedThreads = threadDump.getThreads().stream()
255
.filter(thread -> "BLOCKED".equals(thread.getThreadState()))
256
.collect(Collectors.toList());
257
258
if (!blockedThreads.isEmpty()) {
259
logBlockedThreads(blockedThreads);
260
}
261
}
262
263
public void generateHeapDumpIfNeeded() {
264
long memoryUsage = getMemoryUsagePercentage();
265
if (memoryUsage > 90) {
266
WebEndpointResponse<Resource> heapDump = heapDumpEndpoint.heapDump();
267
saveHeapDump(heapDump.getBody());
268
}
269
}
270
}
271
```
272
273
### Database Migration Endpoints
274
275
Endpoints for database migration tools like Flyway and Liquibase.
276
277
```java { .api }
278
/**
279
* Endpoint to expose Flyway migration information
280
*/
281
@Endpoint(id = "flyway")
282
public class FlywayEndpoint {
283
public FlywayEndpoint(Map<String, Flyway> flywayBeans);
284
285
@ReadOperation
286
public ApplicationFlywayBeans flywayBeans();
287
288
/**
289
* Description of Flyway beans
290
*/
291
public static final class ApplicationFlywayBeans {
292
public Map<String, FlywayDescriptor> getFlywayBeans();
293
294
public static final class FlywayDescriptor {
295
public List<FlywayMigration> getMigrations();
296
297
public static final class FlywayMigration {
298
public String getType();
299
public Integer getChecksum();
300
public String getVersion();
301
public String getDescription();
302
public String getScript();
303
public MigrationState getState();
304
public Date getInstalledOn();
305
public String getInstalledBy();
306
public Integer getInstalledRank();
307
public Integer getExecutionTime();
308
}
309
}
310
}
311
}
312
313
/**
314
* Endpoint to expose Liquibase changeset information
315
*/
316
@Endpoint(id = "liquibase")
317
public class LiquibaseEndpoint {
318
public LiquibaseEndpoint(Map<String, SpringLiquibase> liquibaseBeans);
319
320
@ReadOperation
321
public ApplicationLiquibaseBeans liquibaseBeans();
322
323
/**
324
* Description of Liquibase beans
325
*/
326
public static final class ApplicationLiquibaseBeans {
327
public Map<String, LiquibaseDescriptor> getLiquibaseBeans();
328
329
public static final class LiquibaseDescriptor {
330
public List<LiquibaseChangeset> getChangesets();
331
332
public static final class LiquibaseChangeset {
333
public String getId();
334
public String getAuthor();
335
public String getChangeLog();
336
public String getComments();
337
public Set<String> getContexts();
338
public Date getDateExecuted();
339
public String getDeploymentId();
340
public String getDescription();
341
public String getExecType();
342
public Set<String> getLabels();
343
public String getMd5sum();
344
public Integer getOrderExecuted();
345
public String getTag();
346
}
347
}
348
}
349
}
350
```
351
352
### Session Management Endpoints
353
354
Endpoints for managing user sessions in servlet and reactive applications.
355
356
```java { .api }
357
/**
358
* Endpoint to expose servlet session information
359
*/
360
@Endpoint(id = "sessions")
361
public class SessionsEndpoint {
362
public SessionsEndpoint(SessionRepository sessionRepository);
363
364
@ReadOperation
365
public Map<String, Object> sessionsForUsername(@Selector String username);
366
367
@ReadOperation
368
public Object getSession(@Selector String sessionId);
369
370
@DeleteOperation
371
public Map<String, Object> deleteSession(@Selector String sessionId);
372
}
373
374
/**
375
* Endpoint to expose reactive session information
376
*/
377
@Endpoint(id = "sessions")
378
public class ReactiveSessionsEndpoint {
379
public ReactiveSessionsEndpoint(ReactiveSessionRepository sessionRepository);
380
381
@ReadOperation
382
public Mono<Map<String, Object>> sessionsForUsername(@Selector String username);
383
384
@ReadOperation
385
public Mono<Object> getSession(@Selector String sessionId);
386
387
@DeleteOperation
388
public Mono<Map<String, Object>> deleteSession(@Selector String sessionId);
389
}
390
```
391
392
### Scheduled Tasks Endpoints
393
394
Endpoints for inspecting scheduled tasks and Quartz jobs.
395
396
```java { .api }
397
/**
398
* Endpoint to expose Spring scheduled tasks
399
*/
400
@Endpoint(id = "scheduledtasks")
401
public class ScheduledTasksEndpoint {
402
public ScheduledTasksEndpoint(Collection<ScheduledTaskHolder> scheduledTaskHolders);
403
404
@ReadOperation
405
public ScheduledTasksDescriptor scheduledTasks();
406
407
/**
408
* Description of scheduled tasks
409
*/
410
public static final class ScheduledTasksDescriptor {
411
public List<TaskDescription> getCron();
412
public List<TaskDescription> getFixedDelay();
413
public List<TaskDescription> getFixedRate();
414
public List<TaskDescription> getCustom();
415
416
public static final class TaskDescription {
417
public String getRunnable();
418
public String getExpression();
419
}
420
}
421
}
422
423
/**
424
* Endpoint to expose Quartz scheduler information
425
*/
426
@Endpoint(id = "quartz")
427
public class QuartzEndpoint {
428
public QuartzEndpoint(Scheduler scheduler);
429
430
@ReadOperation
431
public QuartzDescriptor quartzReport();
432
433
@ReadOperation
434
public QuartzJobsDescriptor quartzJobs();
435
436
@ReadOperation
437
public QuartzJobDescriptor quartzJob(@Selector String group, @Selector String name);
438
439
@ReadOperation
440
public QuartzTriggersDescriptor quartzTriggers();
441
442
@ReadOperation
443
public Object quartzTrigger(@Selector String group, @Selector String name);
444
}
445
```
446
447
### Integration and Web Endpoints
448
449
Endpoints for Spring Integration and web request mappings.
450
451
```java { .api }
452
/**
453
* Endpoint to expose Spring Integration graph
454
*/
455
@Endpoint(id = "integrationgraph")
456
public class IntegrationGraphEndpoint {
457
public IntegrationGraphEndpoint(IntegrationGraphServer integrationGraphServer);
458
459
@ReadOperation
460
public Map<String, Object> graph();
461
462
@WriteOperation
463
public void rebuild();
464
}
465
466
/**
467
* Endpoint to expose request mappings
468
*/
469
@Endpoint(id = "mappings")
470
public class MappingsEndpoint {
471
public MappingsEndpoint(Collection<MappingDescriptionProvider> descriptionProviders);
472
473
@ReadOperation
474
public ApplicationMappings mappings();
475
476
/**
477
* Description of application mappings
478
*/
479
public static final class ApplicationMappings {
480
public Map<String, ContextMappings> getContexts();
481
482
public static final class ContextMappings {
483
public Map<String, Object> getMappings();
484
public String getParentId();
485
}
486
}
487
}
488
489
/**
490
* Endpoint to expose HTTP exchanges (request/response traces)
491
*/
492
@Endpoint(id = "httpexchanges")
493
public class HttpExchangesEndpoint {
494
public HttpExchangesEndpoint(HttpExchangeRepository repository);
495
496
@ReadOperation
497
public HttpExchangesDescriptor httpExchanges();
498
499
/**
500
* Description of HTTP exchanges
501
*/
502
public static final class HttpExchangesDescriptor {
503
public List<HttpExchange> getExchanges();
504
505
public static final class HttpExchange {
506
public Instant getTimestamp();
507
public Request getRequest();
508
public Response getResponse();
509
public String getSessionId();
510
public Principal getPrincipal();
511
public Duration getTimeTaken();
512
}
513
}
514
}
515
```
516
517
**Usage Example:**
518
519
```java
520
@RestController
521
public class ApplicationManagementController {
522
523
private final MappingsEndpoint mappingsEndpoint;
524
private final ScheduledTasksEndpoint scheduledTasksEndpoint;
525
private final HttpExchangesEndpoint httpExchangesEndpoint;
526
527
public ApplicationManagementController(MappingsEndpoint mappingsEndpoint,
528
ScheduledTasksEndpoint scheduledTasksEndpoint,
529
HttpExchangesEndpoint httpExchangesEndpoint) {
530
this.mappingsEndpoint = mappingsEndpoint;
531
this.scheduledTasksEndpoint = scheduledTasksEndpoint;
532
this.httpExchangesEndpoint = httpExchangesEndpoint;
533
}
534
535
@GetMapping("/admin/mappings")
536
public ResponseEntity<?> getRequestMappings() {
537
return ResponseEntity.ok(mappingsEndpoint.mappings());
538
}
539
540
@GetMapping("/admin/scheduled-tasks")
541
public ResponseEntity<?> getScheduledTasks() {
542
return ResponseEntity.ok(scheduledTasksEndpoint.scheduledTasks());
543
}
544
545
@GetMapping("/admin/http-traces")
546
public ResponseEntity<?> getHttpExchanges() {
547
return ResponseEntity.ok(httpExchangesEndpoint.httpExchanges());
548
}
549
}
550
551
@Configuration
552
public class EndpointConfiguration {
553
554
@Bean
555
@ConditionalOnMissingBean
556
public HttpExchangeRepository httpExchangeRepository() {
557
return new InMemoryHttpExchangeRepository();
558
}
559
560
@Bean
561
public HttpExchangeTraceFilter httpExchangeTraceFilter(HttpExchangeRepository repository) {
562
return new HttpExchangeTraceFilter(repository);
563
}
564
}
565
```