应用启动(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: 888
{
"springBootVersion" : "4.0.2",
"timeline" : {
"events" : [ {
"duration" : "PT0.000006231S",
"endTime" : "2026-01-22T12:43:53.719192075Z",
"startTime" : "2026-01-22T12:43:53.719185844Z",
"startupStep" : {
"id" : 3,
"name" : "spring.beans.instantiate",
"parentId" : 2,
"tags" : [ {
"key" : "beanName",
"value" : "homeController"
} ]
}
}, {
"duration" : "PT0.00002129S",
"endTime" : "2026-01-22T12:43:53.719197225Z",
"startTime" : "2026-01-22T12:43:53.719175935Z",
"startupStep" : {
"id" : 2,
"name" : "spring.boot.application.starting",
"tags" : [ {
"key" : "mainApplicationClass",
"value" : "com.example.startup.StartupApplication"
} ]
}
} ],
"startTime" : "2026-01-22T12:43:53.420838676Z"
}
}
排空应用启动步骤
要排空并返回应用程序启动阶段迄今为止记录的步骤,请向 /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: 889
{
"springBootVersion" : "4.0.2",
"timeline" : {
"events" : [ {
"duration" : "PT0.000258531S",
"endTime" : "2026-01-22T12:43:53.610992209Z",
"startTime" : "2026-01-22T12:43:53.610733678Z",
"startupStep" : {
"id" : 1,
"name" : "spring.beans.instantiate",
"parentId" : 0,
"tags" : [ {
"key" : "beanName",
"value" : "homeController"
} ]
}
}, {
"duration" : "PT0.018369187S",
"endTime" : "2026-01-22T12:43:53.618077350Z",
"startTime" : "2026-01-22T12:43:53.599708163Z",
"startupStep" : {
"id" : 0,
"name" : "spring.boot.application.starting",
"tags" : [ {
"key" : "mainApplicationClass",
"value" : "com.example.startup.StartupApplication"
} ]
}
} ],
"startTime" : "2026-01-22T12:43:53.420838676Z"
}
}
响应结构
响应包含应用程序启动步骤的详细信息。下表描述了响应的结构:
| 路径 | 类型 | 描述 |
|---|---|---|
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 标签的值。 |