目录
pom.xml配置:(artifact: "@project.artifactId@" #从pom.xml中获取,使生效)
参考文章:
springboot学习27_coffeesunshine的博客-CSDN博客
actuator是spring boot提供的对应用系统的自省和监控的集成功能,可以对应用系统进行配置查看、相关功能统计等。
引入依赖:
<!--boot健康监控-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
yml配置简短版:
management:
endpoint:
health:
enabled: true
yml配置完整版:
#health:http://localhost:54001/actuator/health http://localhost:8882/gatewayUrl/actuator/health
#info:http://localhost:54001/actuator/info http://localhost:8882/gatewayUrl/actuator/info
info:
application: #此处的application可以随意指定
artifact: "@project.artifactId@" #从pom.xml中获取
name: "@project.name@"
description: "@project.description@"
version: "@project.version@"
management:
server:
port: 54001 # 指定监听端口,不指定则与server端口一致(此时需要加server的context-path:/gatewayUrl,并配置/actuator不拦截)
endpoints: # 启动所有监控点,默认情况下只有/info和/heath端点是启用的
web:
exposure:
include: '*'
# endpoint: # 启动指定监控点
# shutdown:
# enabled: true
# health:
# enabled: true
info: # spring-boot 2.6以后info默认值为false.需手动开启
env:
enabled: true
pom.xml配置:(artifact: "@project.artifactId@" #从pom.xml中获取,使生效)
端点介绍: