应用程序启动 (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.4.6",
"timeline" : {
"startTime" : "2025-05-25T10:03:22.552436Z",
"events" : [ {
"endTime" : "2025-05-25T10:03:22.975461Z",
"duration" : "PT0.000002S",
"startupStep" : {
"name" : "spring.beans.instantiate",
"id" : 3,
"tags" : [ {
"key" : "beanName",
"value" : "homeController"
} ],
"parentId" : 2
},
"startTime" : "2025-05-25T10:03:22.975459Z"
}, {
"endTime" : "2025-05-25T10:03:22.975464Z",
"duration" : "PT0.000011S",
"startupStep" : {
"name" : "spring.boot.application.starting",
"id" : 2,
"tags" : [ {
"key" : "mainApplicationClass",
"value" : "com.example.startup.StartupApplication"
} ]
},
"startTime" : "2025-05-25T10:03:22.975453Z"
} ]
}
}
排出应用程序启动步骤
要排出并返回应用程序启动阶段到目前为止记录的步骤,向 /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: 867
{
"springBootVersion" : "3.4.6",
"timeline" : {
"startTime" : "2025-05-25T10:03:22.552436Z",
"events" : [ {
"endTime" : "2025-05-25T10:03:22.887234Z",
"duration" : "PT0.000362S",
"startupStep" : {
"name" : "spring.beans.instantiate",
"id" : 1,
"tags" : [ {
"key" : "beanName",
"value" : "homeController"
} ],
"parentId" : 0
},
"startTime" : "2025-05-25T10:03:22.886872Z"
}, {
"endTime" : "2025-05-25T10:03:22.887262Z",
"duration" : "PT0.00193S",
"startupStep" : {
"name" : "spring.boot.application.starting",
"id" : 0,
"tags" : [ {
"key" : "mainApplicationClass",
"value" : "com.example.startup.StartupApplication"
} ]
},
"startTime" : "2025-05-25T10:03:22.885332Z"
} ]
}
}
响应结构
响应包含应用程序启动步骤的详细信息。 下表描述了响应的结构:
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. |