zoukankan      html  css  js  c++  java
  • Spring Boot Actuator的端点

      Spring Boot Actuator的关键特性是在应用程序里提供众多Web端点,通过它们了解应用程序 运行时的内部状况。有了Actuator,你可以知道Bean在Spring应用程序上下文里是如何组装在一起的,掌握应用程序可以获取的环境属性信息,获取运行时度量信息的快照……

      

      Actuator提供13个端点,可以分为三大类:配置端点、度量端点和其他端点。具体如下表所示:

    Http方法路径描述
    get /autoconfig 提供了一份自动配置报告,记录哪些自动配置条件通过了,哪些没通过
    get /configprops 描述配置属性(包含默认值)如何注入Bean
    get /beans 描述应用程序上下文里全部的Bean,以及它们的关系
    get /dump 获取线程活动的快照
    get /env 获取全部环境属性
    get /env/{name} 根据名称获取特定的环境属性值
    get /health 报告应用程序的健康指标,这些值由 HealthIndicator 的实现类提供
    get /info 获取应用程序的定制信息,这些信息由 info 打头的属性提供
    get /mappings 描述全部的URI路径,以及它们和控制器(包含Actuator端点)的映射关系
    get /metrics 报告各种应用程序度量信息,比如内存用量和HTTP请求计数
    get /metrics/{name} 报告指定名称的应用程序度量值
    post /shutdown 关闭应用程序,要求 endpoints.shutdown.enabled 设置为 true
    get /trace 提供基本的HTTP请求跟踪信息(时间戳、HTTP头等)

      

      要启用Actuator的端点,只需在项目中引入Actuator的起步依赖即可。

      在Gradle构建说明文件里,这个依赖是这样的:

    compile 'org.springframework.boot:spring-boot-starter-actuator'

      

      对于Maven项目,引入的依赖是这样的:

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

      

      亦或你使用Spring Boot CLI,可以使用如下 @Grab 注解:

    @Grab('spring-boot-starter-actuator')
  • 相关阅读:
    Helvetic Coding Contest 2016 online mirror D1
    Helvetic Coding Contest 2016 online mirror C1
    Helvetic Coding Contest 2016 online mirror A1
    Educational Codeforces Round 13 C
    Educational Codeforces Round 13 B
    Educational Codeforces Round 13 A
    2016计蒜之道初赛第四场A
    帆软出品: 7点搞定制药企业数据分析系统开发需求
    制药企业BI系统方案整体设计分享
    Ubuntu ROS Arduino Gazebo学习镜像iso说明(indigo版)
  • 原文地址:https://www.cnblogs.com/sprinkle/p/7064880.html
Copyright © 2011-2022 走看看