zoukankan      html  css  js  c++  java
  • Spring Boot Actuator Endpoints

    常用内建的Endpoints:

    beans:显示当前Spring应用上下文的Spring Bean完整列表(包含所有ApplicationContext的层次)
    conditions:显示当前应用所有配置类和自动装配类的条件评估结果(包含匹配和非匹配)
    env:暴露Spring ConfigurableEnvironment中的PropertySource属性
    health:显示应用的健康信息
    info:显示任意的应用信息。

    如果需要暴露Endpoints,需在application.properties或启动参数中,增加:

    management.endpoints.web.exposure.include=*

    或者

    management.endpoints.web.exposure.include=beans,env,health,info

    示例:

    1、在pom.xml中加入依赖

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

    2、在application.properties中,加入

    management.endpoints.web.exposure.include=beans,env,health,info

    3、启动,日志发现

    o.s.b.a.e.web.EndpointLinksResolver      : Exposing 1 endpoint(s) beneath base path '/actuator'

    4、执行

    http://localhost:8080/actuator/env

    输出:

    "java.runtime.version": {
    "value": "1.8.0_51-b16"
    },

    "java.home": {
    "value": "D:\env\j2ee\java\64bit\java8\jdk8\jre"
    },

    "catalina.home": {
    "value": "C:\Users\Administrator\AppData\Local\Temp\tomcat.8258922389092648732.8080"
    },

    {
    "name": "applicationConfig: [classpath:/application.properties]",
    "properties": {
    "management.endpoints.web.exposure.include": {
    "value": "beans,env,health,info",
    "origin": "class path resource [application.properties]:1:43"
    }
    }

    执行

    http://localhost:8080/actuator/health

    输出

    {"status":"UP"}

  • 相关阅读:
    django学习笔记
    django配置setting文件
    django用mysql数据库出现的问题解决
    hadoop本地集群搭建
    生成器
    Java自动装箱的陷阱
    LeetCode 89. Gray Code
    LeetCode 476. Number Complement
    Javac编译与JIT编译
    LeetCode 462. Minimum Moves to Equal Array Elements II
  • 原文地址:https://www.cnblogs.com/yaoyuan2/p/11742242.html
Copyright © 2011-2022 走看看