`

Spring Boot Actuator

阅读更多

Spring Boot : 2.0.3

POM文件中加入

  <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
<dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
          </dependency>

 

启动Tomcat时,在 console 里增加了以下的日志

1.访问:http://localhost:8080/actuator/health,返回

{
"status": "UP"
}

2. 访问: http://localhost:8080/actuator/info,返回

{}

通过SpringBoot 官网得知, 对于Web 下查看,只有health 和 info 两个endpoint 是enable 的

https://docs.spring.io/spring-boot/docs/2.0.3.RELEASE/reference/htmlsingle/#production-ready-enabling

 

在src\main\resources\application.properties 中增加下面的内容,打开所有的 endpoint, 并重新启动,在日志里可以看到下面内容

management.endpoints.web.exposure.include=*

可以已经exposing 14 endpoints

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics