config-server的配置:
application.yml:
spring:
application:
name: config-server
cloud:
config:
server:
git:
uri: https://gitee.com/xgpxg/spring-cloud-config
username: ***
password: ***
search-paths: config/
kafka:
bootstrap-servers: ip:port
eureka:
client:
service-url:
defaultZone: http://localhost:5000/eureka
healthcheck:
enabled: true
server:
port: 5008
management:
endpoint:
health:
show-details: always
endpoints:
web:
exposure:
include: bus-refresh
#注意这里的bus-refresh不能写成"*",否则会导致配置中心请求路径和bus-refresh冲突
config-client配置
bootstrap.yml
eureka:
client:
service-url:
defaultZone: http://localhost:5000/eureka
spring:
cloud:
config:
discovery:
service-id: config-server
enabled: true
profile: dev
label: master
name: appconfig
application.yml
spring:
application:
name: service-a
kafka:
bootstrap-servers: ip:port
eureka:
client:
service-url:
defaultZone: http://localhost:5000/eureka
healthcheck:
enabled: true
server:
port: 5007
management:
endpoint:
health:
show-details: always
endpoints:
web:
exposure:
include: "*"
application.yml中的配置可以写在bootstrap.yml里,但是需要去掉 healthcheck.enabled=true
注意是Post请求,否则405