应用启动(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: 868
{
"springBootVersion" : "3.5.0",
"timeline" : {
"startTime" : "2025-05-26T03:08:26.524630Z",
"events" : [ {
"endTime" : "2025-05-26T03:08:26.576737Z",
"duration" : "PT0.000002S",
"startTime" : "2025-05-26T03:08:26.576735Z",
"startupStep" : {
"name" : "spring.beans.instantiate",
"id" : 3,
"tags" : [ {
"key" : "beanName",
"value" : "homeController"
} ],
"parentId" : 2
}
}, {
"endTime" : "2025-05-26T03:08:26.576739Z",
"duration" : "PT0.000007S",
"startTime" : "2025-05-26T03:08:26.576732Z",
"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: 868
{
"springBootVersion" : "3.5.0",
"timeline" : {
"startTime" : "2025-05-26T03:08:26.524630Z",
"events" : [ {
"endTime" : "2025-05-26T03:08:26.567457Z",
"duration" : "PT0.000072S",
"startTime" : "2025-05-26T03:08:26.567385Z",
"startupStep" : {
"name" : "spring.beans.instantiate",
"id" : 1,
"tags" : [ {
"key" : "beanName",
"value" : "homeController"
} ],
"parentId" : 0
}
}, {
"endTime" : "2025-05-26T03:08:26.567467Z",
"duration" : "PT0.000494S",
"startTime" : "2025-05-26T03:08:26.566973Z",
"startupStep" : {
"name" : "spring.boot.application.starting",
"id" : 0,
"tags" : [ {
"key" : "mainApplicationClass",
"value" : "com.example.startup.StartupApplication"
} ]
}
} ]
}
}
响应结构
响应包含应用启动步骤的详细信息。 下表描述了响应的结构:
Path | Type | Description |
---|---|---|
|
|
Spring Boot version for this application. |
|
|
Start time of the application. |
|
|
An array of steps collected during application startup so far. |
|
|
The timestamp of the start of this event. |
|
|
The timestamp of the end of this event. |
|
|
The precise duration of this event. |
|
|
The name of the StartupStep. |
|
|
The id of this StartupStep. |
|
|
The parent id for this StartupStep. |
|
|
An array of key/value pairs with additional step info. |
|
|
The key of the StartupStep Tag. |
|
|
The value of the StartupStep Tag. |