此版本仍在开发中,尚不被认为是稳定的。对于最新的稳定版本,请使用 Spring Boot 3.5.5! |
应用程序启动 (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: 892
{
"springBootVersion" : "4.0.0-M2",
"timeline" : {
"events" : [ {
"duration" : "PT0.000005249S",
"endTime" : "2025-08-21T20:11:59.388358472Z",
"startTime" : "2025-08-21T20:11:59.388353223Z",
"startupStep" : {
"id" : 3,
"name" : "spring.beans.instantiate",
"parentId" : 2,
"tags" : [ {
"key" : "beanName",
"value" : "homeController"
} ]
}
}, {
"duration" : "PT0.000018204S",
"endTime" : "2025-08-21T20:11:59.388363662Z",
"startTime" : "2025-08-21T20:11:59.388345458Z",
"startupStep" : {
"id" : 2,
"name" : "spring.boot.application.starting",
"tags" : [ {
"key" : "mainApplicationClass",
"value" : "com.example.startup.StartupApplication"
} ]
}
} ],
"startTime" : "2025-08-21T20:11:59.141000292Z"
}
}
清空应用程序启动步骤
要清空并返回到目前为止在应用程序启动阶段记录的步骤,请将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: 892
{
"springBootVersion" : "4.0.0-M2",
"timeline" : {
"events" : [ {
"duration" : "PT0.000269193S",
"endTime" : "2025-08-21T20:11:59.345262006Z",
"startTime" : "2025-08-21T20:11:59.344992813Z",
"startupStep" : {
"id" : 1,
"name" : "spring.beans.instantiate",
"parentId" : 0,
"tags" : [ {
"key" : "beanName",
"value" : "homeController"
} ]
}
}, {
"duration" : "PT0.001276664S",
"endTime" : "2025-08-21T20:11:59.345297011Z",
"startTime" : "2025-08-21T20:11:59.344020347Z",
"startupStep" : {
"id" : 0,
"name" : "spring.boot.application.starting",
"tags" : [ {
"key" : "mainApplicationClass",
"value" : "com.example.startup.StartupApplication"
} ]
}
} ],
"startTime" : "2025-08-21T20:11:59.141000292Z"
}
}
响应结构
响应包含应用程序启动步骤的详细信息。下表描述了响应的结构:
路径 | 类型 | 描述 |
---|---|---|
|
|
此应用程序的 Spring Boot 版本。 |
|
|
应用程序的开始时间。 |
|
|
到目前为止,在应用程序启动期间收集的一系列步骤。 |
|
|
此事件开始的时间戳。 |
|
|
此事件结束的时间戳。 |
|
|
此事件的确切持续时间。 |
|
|
StartupStep 的名称。 |
|
|
此 StartupStep 的 ID。 |
|
|
此 StartupStep 的父 ID。 |
|
|
带有其他步骤信息的键/值对数组。 |
|
|
StartupStep 标记的键。 |
|
|
StartupStep 标记的值。 |