从 Spring Boot Actuator 获取系统信息
Getting system info from Spring Boot Actuator
我有一个 SpringBoot 应用程序。 2.1.3.RELEASE securized by JWT,我想加一个actuator。我添加了这个依赖项
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
我已将此属性添加到 application.properties
文件
management.endpoints.web.exposure.include=health,info
management.endpoint.health.show-details=always
当我访问 /actuator
时,我得到了这样的回复:
{
"_links": {
"self": {
"href": "http://127.0.0.1:1133/tdk/actuator",
"templated": false
},
"health": {
"href": "http://127.0.0.1:1133/tdk/actuator/health",
"templated": false
},
"health-component": {
"href": "http://127.0.0.1:1133/tdk/actuator/health/{component}",
"templated": true
},
"health-component-instance": {
"href": "http://127.0.0.1:1133/tdk/actuator/health/{component}/{instance}",
"templated": true
},
"info": {
"href": "http://127.0.0.1:1133/tdk/actuator/info",
"templated": false
}
}
}
但是当我访问 http://127.0.0.1:1133/tdk/actuator/info
时,我只有
{}
您需要添加 build-info
目标来生成构建信息。 see doc here 获取更多信息。
我有一个 SpringBoot 应用程序。 2.1.3.RELEASE securized by JWT,我想加一个actuator。我添加了这个依赖项
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
我已将此属性添加到 application.properties
文件
management.endpoints.web.exposure.include=health,info
management.endpoint.health.show-details=always
当我访问 /actuator
时,我得到了这样的回复:
{
"_links": {
"self": {
"href": "http://127.0.0.1:1133/tdk/actuator",
"templated": false
},
"health": {
"href": "http://127.0.0.1:1133/tdk/actuator/health",
"templated": false
},
"health-component": {
"href": "http://127.0.0.1:1133/tdk/actuator/health/{component}",
"templated": true
},
"health-component-instance": {
"href": "http://127.0.0.1:1133/tdk/actuator/health/{component}/{instance}",
"templated": true
},
"info": {
"href": "http://127.0.0.1:1133/tdk/actuator/info",
"templated": false
}
}
}
但是当我访问 http://127.0.0.1:1133/tdk/actuator/info
时,我只有
{}
您需要添加 build-info
目标来生成构建信息。 see doc here 获取更多信息。