应用程序启动 (startup
)
这startup
endpoint 提供有关应用程序启动顺序的信息。
检索应用程序启动步骤
应用程序启动步骤可以作为快照 (GET
)或从缓冲液中排出(POST
).
检索应用程序启动步骤的快照
要检索到目前为止在应用程序启动阶段记录的步骤,请将GET
请求/actuator/startup
,如以下基于 curl 的示例所示:
$ curl 'http://localhost:8080/actuator/startup' -i -X GET
生成的响应类似于以下内容:
HTTP/1.1 200 OK
Content-Type: application/vnd.spring-boot.actuator.v3+json
Content-Length: 889
{
"springBootVersion" : "3.5.5",
"timeline" : {
"startTime" : "2025-08-21T09:11:57.780850636Z",
"events" : [ {
"endTime" : "2025-08-21T09:11:58.163473754Z",
"duration" : "PT0.000006552S",
"startTime" : "2025-08-21T09:11:58.163467202Z",
"startupStep" : {
"name" : "spring.beans.instantiate",
"id" : 3,
"tags" : [ {
"key" : "beanName",
"value" : "homeController"
} ],
"parentId" : 2
}
}, {
"endTime" : "2025-08-21T09:11:58.163481729Z",
"duration" : "PT0.000023193S",
"startTime" : "2025-08-21T09:11:58.163458536Z",
"startupStep" : {
"name" : "spring.boot.application.starting",
"id" : 2,
"tags" : [ {
"key" : "mainApplicationClass",
"value" : "com.example.startup.StartupApplication"
} ]
}
} ]
}
}
清空应用程序启动步骤
要清空并返回到目前为止在应用程序启动阶段记录的步骤,请将POST
请求/actuator/startup
,如以下基于 curl 的示例所示:
$ curl 'http://localhost:8080/actuator/startup' -i -X POST
生成的响应类似于以下内容:
HTTP/1.1 200 OK
Content-Type: application/vnd.spring-boot.actuator.v3+json
Content-Length: 889
{
"springBootVersion" : "3.5.5",
"timeline" : {
"startTime" : "2025-08-21T09:11:57.780850636Z",
"events" : [ {
"endTime" : "2025-08-21T09:11:58.056833331Z",
"duration" : "PT0.000301706S",
"startTime" : "2025-08-21T09:11:58.056531625Z",
"startupStep" : {
"name" : "spring.beans.instantiate",
"id" : 1,
"tags" : [ {
"key" : "beanName",
"value" : "homeController"
} ],
"parentId" : 0
}
}, {
"endTime" : "2025-08-21T09:11:58.056863086Z",
"duration" : "PT0.001481829S",
"startTime" : "2025-08-21T09:11:58.055381257Z",
"startupStep" : {
"name" : "spring.boot.application.starting",
"id" : 0,
"tags" : [ {
"key" : "mainApplicationClass",
"value" : "com.example.startup.StartupApplication"
} ]
}
} ]
}
}
响应结构
响应包含应用程序启动步骤的详细信息。 下表描述了响应的结构:
路径 | 类型 | 描述 |
---|---|---|
|
|
此应用程序的 Spring Boot 版本。 |
|
|
应用程序的开始时间。 |
|
|
到目前为止,在应用程序启动期间收集的一系列步骤。 |
|
|
此事件开始的时间戳。 |
|
|
此事件结束的时间戳。 |
|
|
此事件的确切持续时间。 |
|
|
StartupStep 的名称。 |
|
|
此 StartupStep 的 ID。 |
|
|
此 StartupStep 的父 ID。 |
|
|
带有其他步骤信息的键/值对数组。 |
|
|
StartupStep 标记的键。 |
|
|
StartupStep 标记的值。 |