springBoot运维监控(spring-boot-starter-actuator)及浏览器查看(spring-boot-starter-hateoas) - Go语言中文社区

springBoot运维监控(spring-boot-starter-actuator)及浏览器查看(spring-boot-starter-hateoas)


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 

以上!

版权声明:本文来源CSDN,感谢博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
原文链接:https://blog.csdn.net/qq360452913/article/details/86585468
站方申明:本站部分内容来自社区用户分享,若涉及侵权,请联系站方删除。
  • 发表于 2021-05-17 03:08:45
  • 阅读 ( 1907 )
  • 分类:运维

0 条评论

请先 登录 后评论

官方社群

GO教程

猜你喜欢