首页 > 编程语言 > 详细

Spring Boot Actuator Endpoints

时间:2019-10-26 13:24:17      阅读:135      评论:0      收藏:0      [点我收藏+]

 

常用内建的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"}

 

Spring Boot Actuator Endpoints

原文:https://www.cnblogs.com/yaoyuan2/p/11742242.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!