<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
management:
endpoints:
web:
## 自定义根目录,防止被恶意访问获取系统运行信息
base-path: /my-actuator
# 访问根目录查看当前可以供使用的监控地址
$ curl localhost:8080/my-actuator
{
links: {
self: {
href: "http://localhost:8080/my-actuator",
templated: false
},
health: {
href: "http://localhost:8080/my-actuator/health",
templated: false
},
health-component: {
href: "http://localhost:8080/my-actuator/health/{component}",
templated: true
},
health-component-instance: {
href: "http://localhost:8080/my-actuator/health/{component}/{instance}",
templated: true
},
info: {
href: "http://localhost:8080/my-actuator/info",
templated: false
}
}
}
management:
endpoints:
web:
base-path: /my-actuator
exposure:
include: "*"
management:
endpoints:
web:
base-path: /my-actuator
exposure:
## 关闭环境变量监控端点
exclude: "env"