第一步,添加依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
第二步,添加应用的 info 信息
在 application.yml 里添加如下参数
info:
app:
name: "@project.name@"
description: "@project.description@"
version: "@project.version@"
spring-boot-version: "@spring.boot.version@"
注:@spring.boot.version@ 参数需要在 pom.xml 配置
<properties>
<spring.boot.version>1.5.2.RELEASE</spring.boot.version>
</properties>
此时,访问 /info 就能看到你配置的应用信息
第三步,停用安全管理
在 application.yml 里添加如下参数
management:
security:
enabled: false
此时,访问 /health 和 /metrics 就能看到应用的相关参数
代码没看太懂的啊。。。[em00]