社区微信群开通啦,扫一扫抢先加入社区官方微信群
社区微信群
1,首先,引入相关的依赖,最好和spring-boot-starter-parent的版本保持一致
监控:
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> 以json格式输出信息: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-hateoas</artifactId> <version>2.1.2.RELEASE</version> </dependency>
浏览器访问:localhost:8080/actuator
查看其它信息:比如health 直接点击对应的请求地址http://localhost:8080/actuator/health
以上是配置了监控查看所有的信息,配置如下,可根据需要自己修改
中间遇到的坑:访问localhost:8080/actuator报404错误,其它到controller的请求能够正常映射,原因:jar包出现问题,作用域是actuator的scope是test
解决方式;去掉scope
以上!
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!