Spring Boot从0开始学的个人笔记13 --spring boot actuator监管

1、简述

监管嘛,就是看你程序有什么东西,正在运行的,什么权限之类的东西

2、使用方法

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

application.properties中设置

#有权利访问各种监管
management.endpoints.web.exposure.include=*

#打开shutdown功能(发送请求让Java程序关闭)
management.endpoint.shutdown.enabled=true

1)一些简单的东西

比如我们访问http://localhost:8080/actuator/beans
在这里插入图片描述
你有什么bean,这里都会显示,
又比如访问http://localhost:8080/actuator/env
在这里插入图片描述
显示了环境变量。

2)shutdown

我个人认为最爽的还是shutdown,这个可以通过浏览器让Java程序关闭,不过要发post请求才可以
http://localhost:8080/actuator/shutdown
在这里插入图片描述
在这里插入图片描述

3)更多的监管

官方文档

猜你喜欢

转载自blog.csdn.net/yi742891270/article/details/107858948