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版
版权声明:本文为army2000原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。