SpringBoot的 Actuator 是做什么的?

发布于 2020-07-11 15:54:57
关注者
0
被浏览
768
1 个回答
  • 面试哥
    面试哥 2020-07-11
    为面试而生,有面试问题,就找面试哥。

    本质上,Actuator 通过启用 production-ready 功能使得 SpringBoot 应用程序变得更有生命力。这些功能允许我们对生产环境中的应用程序进行监视和管理。

    集成 SpringBoot Actuator 到项目中非常简单。我们需要做的只是将 spring-boot-starter-actuator starter 引入到 POM.xml 文件当中:

    1 <dependency>
    2     <groupId>org.springframework.boot</groupId>
    3     <artifactId>spring-boot-starter-actuator</artifactId>
    4 </dependency>
    

    SpringBoot Actuaor 可以使用 HTTP 或者 JMX endpoints来浏览操作信息。大多数应用程序都是用 HTTP,作为 endpoint 的标识以及使用 /actuator 前缀作为 URL路径。

    这里有一些常用的内置 endpoints Actuator:

    • auditevents:查看 audit 事件信息
    • env:查看 环境变量
    • health:查看应用程序健康信息
    • httptrace:展示 HTTP 路径信息
    • info:展示 arbitrary 应用信息
    • metrics:展示 metrics 信息
    • loggers:显示并修改应用程序中日志器的配置
    • mappings:展示所有 @RequestMapping 路径信息
    • scheduledtasks:展示应用程序中的定时任务信息
    • threaddump:执行 Thread Dump
知识点
面圈网VIP题库

面圈网VIP题库全新上线,海量真题题库资源。 90大类考试,超10万份考试真题开放下载啦

去下载看看