SpringCloud Config + SpringCloud Bus实时刷新配置的配置

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

请求路径:http://localhost:5008/actuator/bus-refresh?destination=service-a

注意是Post请求,否则405

posted @ 2019-05-29 14:35  SEC.VIP_网络安全服务  阅读(143)  评论(0编辑  收藏  举报