Spring Boot Actuator 介绍

编程入门 行业动态 更新时间:2024-10-12 22:30:17

<a href=https://www.elefans.com/category/jswz/34/1769862.html style=Spring Boot Actuator 介绍"/>

Spring Boot Actuator 介绍

Spring Boot Actuator是什么

Spring Boot Actuator 模块提供了生产级别的功能,比如健康检查,审计,指标收集,HTTP 跟踪等,帮助我们监控和管理Spring Boot 应用。

这个模块是一个采集应用内部信息暴露给外部的模块,上述的功能都可以通过HTTP 和 JMX 访问。

启用 Spring Boot Actuator 功能

只需要添加其启动器依赖即可,依赖配置如下:

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

 端点介绍

Endpoint 端点用来监控 Spring Boot 应用程序并能与之交互,Spring Boot 内置了许多端点,开箱即用。

每个端点都可以通过 HTTP 或者 JMX(Java Management Extensions)的方式暴露出去,但绝大多数情况端点都是以 HTTP 的方式暴露,每个端点都会被映射为 /actuator/${ID} 方式,ID 即为端点的 ID,比如健康端点为:/actuator/health。

启用端点

除了 shutdown 端点,其他所有端点默认都是启用的,也可以针对某个端点进行启用和禁用,启用、禁用:

management:endpoint:shutdown:enabled: true

如也可以先禁用全部端点,然后再启用某个端点,如下面配置所示: 

management:endpoints:enabled-by-default: falseendpoint:info:enabled: true

更多推荐

Spring Boot Actuator 介绍

本文发布于:2023-12-03 11:31:58,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1654873.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Spring   Boot   Actuator

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!