Spring boot actuator与Spring boot admin对接,2.0版本

匿名 (未验证) 提交于 2019-12-03 00:34:01

gradle构建工程

spring-boot-admin-server

build.gradle

    compile group: 'de.codecentric', name: 'spring-boot-admin-starter-server', version: '2.0.0'     compile group: 'org.springframework.boot', name: 'spring-boot-starter-actuator', version: '2.0.2.RELEASE'     compile group: 'org.springframework.boot', name: 'spring-boot-starter-webflux', version: '2.0.2.RELEASE'     compile group: 'org.jolokia', name: 'jolokia-core', version: '1.5.0'     compile group: 'org.springframework.boot', name: 'spring-boot-starter-actuator', version: '2.0.2.RELEASE' 

application.yml

eureka:     instance:         preferIpAddress: true         leaseRenewalIntervalInSeconds: 10     client:         registryFetchIntervalSeconds: 5         service-url:             defaultZone: ${EUREKA_SERVICE_URL:http://127.0.0.1:8080}/eureka/  management:     endpoints:         web:             exposure:                 include: "*"     endpoint:         health:             show-details: ALWAYS    #开启shutdown的安全验证 endpoint:   health:     sensitive: true   cors:     allowed-methods: HEAD,GET,POST   shutdown:   #启用shutdown     enabled: true     #禁用密码验证     sensitive: false

spring-boot-admin-client

build.gradle

    // springboot client     compile group: 'de.codecentric', name: 'spring-boot-admin-starter-client', version: '2.0.0'     compile group: 'org.springframework.boot', name: 'spring-boot-starter-actuator', version: '2.0.2.RELEASE' //    compile group: 'org.springframework.boot', name: 'spring-boot-starter-security', version: '2.0.2.RELEASE'     compile group: 'org.jolokia', name: 'jolokia-core', version: '1.5.0'

application.yml

info:   app:     name: "server容器"     description : "业务系统"     version: "1.0"     spring-boot-version : "2.0.2.RELEASE"   version: "1.0"  #spring admin boot client config management:   server:     port: 11002     servlet:       context-path: /     ssl:       enabled: false   endpoints:     web:       exposure:         include: "*"   endpoint:     health:       show-details: always
spring:     boot:       admin:         client:           url: http://127.0.0.1:8080/administrator

启动即可完成

注意几点:

1、health为down增加

management:   endpoint:     health:       show-details: always

2、只能访问info,添加

management:   endpoints:     web:       exposure:         include: "*"
其他问题应该不大,版本2.0版

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!