SpringBoot 2.x 监控中心:Actuator

转载请标明出处:http://blog.csdn.net/zhaoyanjun6/article/details/80762234
本文出自【赵彦军的博客】

简介

Actuatorspring boot项目中非常强大一个功能,有助于对应用程序进行监视和管理,通过 restful api请求来监管、审计、收集应用的运行情况,针对微服务而言它是必不可少的一个环节。

依赖集成

buildscript {
    ext {
        springBootVersion = '2.0.2.RELEASE'
    }
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

group = 'com.yanjun'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8

repositories {
    mavenCentral()
}


dependencies {
    compile('org.springframework.boot:spring-boot-starter',
            'org.springframework.boot:spring-boot-starter-web',
            'org.springframework.boot:spring-boot-starter-actuator'  //监控中心
    )
}

application.yml 里填写配置信息

management:
  server:
    port: 8083  #自定义actuator端口
  endpoints:
    web:
      exposure:
        include: "*"  #监控所有的接口

server:
  port: 8080  #自定义spring服务端口

内置Endpoints

名字 作用
beans 显示应用Spring Beans的完整列表
health 显示应用的健康信息(未认证只显示status,认证显示全部信息详情)
info 显示自定义的应用信息(在资源文件写info.xxx即可)
mappings 显示所有 @RequestMapping 路径集列表
scheduledtasks 显示应用程序中的计划任务
threaddump 显示线程dump
httptrace 示HTTP跟踪信息(默认显示最后100个HTTP请求 - 响应交换)
conditions 显示所有 @ConfigurationProperties 列表
caches 显示可用缓存信息

个人微信号:zhaoyanjun125 , 欢迎关注

猜你喜欢

转载自blog.csdn.net/zhaoyanjun6/article/details/80762234