ITeye博客

Spring Boot Actuator

qingfeng825 · 2018-07-24 13:46 · java基础 · work · 开源软件 · Markdown

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

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。