应用启动(startup)
startup)
startup 端点提供有关应用程序启动序列的信息。
检索应用程序启动步骤
应用程序启动步骤可以以快照形式获取(GET),也可以从缓冲区中清空获取(POST)。
检索应用程序启动步骤的快照
要检索应用程序启动阶段迄今为止记录的步骤,请向 /actuator/startup 发起一个 GET 请求,如下列基于 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: 890
{
"springBootVersion" : "3.5.10",
"timeline" : {
"startTime" : "2026-01-22T08:01:04.885902392Z",
"events" : [ {
"endTime" : "2026-01-22T08:01:05.146669708Z",
"duration" : "PT0.000005281S",
"startTime" : "2026-01-22T08:01:05.146664427Z",
"startupStep" : {
"name" : "spring.beans.instantiate",
"id" : 3,
"tags" : [ {
"key" : "beanName",
"value" : "homeController"
} ],
"parentId" : 2
}
}, {
"endTime" : "2026-01-22T08:01:05.146675298Z",
"duration" : "PT0.000018234S",
"startTime" : "2026-01-22T08:01:05.146657064Z",
"startupStep" : {
"name" : "spring.boot.application.starting",
"id" : 2,
"tags" : [ {
"key" : "mainApplicationClass",
"value" : "com.example.startup.StartupApplication"
} ]
}
} ]
}
}
排空应用程序启动步骤
要在应用程序启动阶段排空并返回迄今为止记录的步骤,请向 /actuator/startup 发起一个 POST 请求,如下列基于 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: 890
{
"springBootVersion" : "3.5.10",
"timeline" : {
"startTime" : "2026-01-22T08:01:04.885902392Z",
"events" : [ {
"endTime" : "2026-01-22T08:01:05.103133776Z",
"duration" : "PT0.003307308S",
"startTime" : "2026-01-22T08:01:05.099826468Z",
"startupStep" : {
"name" : "spring.beans.instantiate",
"id" : 1,
"tags" : [ {
"key" : "beanName",
"value" : "homeController"
} ],
"parentId" : 0
}
}, {
"endTime" : "2026-01-22T08:01:05.103168100Z",
"duration" : "PT0.005392299S",
"startTime" : "2026-01-22T08:01:05.097775801Z",
"startupStep" : {
"name" : "spring.boot.application.starting",
"id" : 0,
"tags" : [ {
"key" : "mainApplicationClass",
"value" : "com.example.startup.StartupApplication"
} ]
}
} ]
}
}
响应结构
响应包含应用程序启动步骤的详细信息。下表描述了响应的结构:
| 路径 | 类型 | 描述 |
|---|---|---|
springBootVersion | String | 此应用程序的 Spring Boot 版本。 |
timeline.startTime | String | 应用程序的启动时间。 |
timeline.events | Array | 至今在应用程序启动期间收集的步骤数组。 |
timeline.events.[].startTime | String | 此事件开始的时间戳。 |
timeline.events.[].endTime | String | 此事件结束的时间戳。 |
timeline.events.[].duration | String | 此事件的精确持续时间。 |
timeline.events.[].startupStep.name | String | StartupStep 的名称。 |
timeline.events.[].startupStep.id | Number | 此 StartupStep 的 ID。 |
timeline.events.[].startupStep.parentId | Number | 此 StartupStep 的父 ID。 |
timeline.events.[].startupStep.tags | Array | 包含额外步骤信息的键/值对数组。 |
timeline.events.[].startupStep.tags[].key | String | StartupStep 标签的键。 |
timeline.events.[].startupStep.tags[].value | String | StartupStep 标签的值。 |