应用程序启动 (startup)
startup
端点提供有关应用程序启动顺序的信息。
获取应用程序启动步骤
应用程序启动步骤可以作为快照(GET
)或从缓冲区中排出(POST
)进行获取。
获取应用程序启动步骤的快照
要获取在应用程序启动阶段记录的步骤快照,可以按照以下基于 curl 的示例发送 GET
请求到 /actuator/startup
:
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" : "3.3.3", "timeline" : { "startTime" : "2024-08-22T16:50:34.319587289Z", "events" : [ { "endTime" : "2024-08-22T16:50:34.644774146Z", "duration" : "PT0.00000539S", "startTime" : "2024-08-22T16:50:34.644768756Z", "startupStep" : { "name" : "spring.beans.instantiate", "id" : 3, "tags" : [ { "key" : "beanName", "value" : "homeController" } ], "parentId" : 2 } }, { "endTime" : "2024-08-22T16:50:34.644781199Z", "duration" : "PT0.000019015S", "startTime" : "2024-08-22T16:50:34.644762184Z", "startupStep" : { "name" : "spring.boot.application.starting", "id" : 2, "tags" : [ { "key" : "mainApplicationClass", "value" : "com.example.startup.StartupApplication" } ] } } ] } }
排出应用程序启动步骤
要排出并返回应用程序启动阶段记录的步骤,可以按照以下基于 curl 的示例发送 POST
请求到 /actuator/startup
:
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" : "3.3.3", "timeline" : { "startTime" : "2024-08-22T16:50:34.319587289Z", "events" : [ { "endTime" : "2024-08-22T16:50:34.581934910Z", "duration" : "PT0.000208118S", "startTime" : "2024-08-22T16:50:34.581726792Z", "startupStep" : { "name" : "spring.beans.instantiate", "id" : 1, "tags" : [ { "key" : "beanName", "value" : "homeController" } ], "parentId" : 0 } }, { "endTime" : "2024-08-22T16:50:34.581963633Z", "duration" : "PT0.001131896S", "startTime" : "2024-08-22T16:50:34.580831737Z", "startupStep" : { "name" : "spring.boot.application.starting", "id" : 0, "tags" : [ { "key" : "mainApplicationClass", "value" : "com.example.startup.StartupApplication" } ] } } ] } }
响应结构
响应包含应用程序启动步骤的详细信息。下表描述了响应的结构:
路径 |
类型 |
描述 |
|
|
此应用程序的 Spring Boot 版本。 |
|
|
应用程序的启动时间。 |
|
|
在应用程序启动过程中收集的步骤数组。 |
|
|
该事件开始的时间戳。 |
|
|
该事件结束的时间戳。 |
|
|
该事件的精确持续时间。 |
|
|
启动步骤的名称。 |
|
|
该启动步骤的 ID。 |
|
|
该启动步骤的父 ID。 |
|
|
包含附加步骤信息的键/值对数组。 |
|
|
启动步骤标签的键。 |
|
|
启动步骤标签的值。 |