spring cloud bus + kafka 实现配置热更新

一、config-server

       依赖:

       


   4.0.0
   
      org.springframework.boot
      spring-boot-starter-parent
      2.0.6.RELEASE
       
   
   com.hcloud
   config
   0.0.1-SNAPSHOT
   config
   config zone

   
      1.8
      Finchley.SR2
   

   
      
         org.springframework.cloud
         spring-cloud-config-server
      
      
         org.springframework.cloud
         spring-cloud-starter-netflix-eureka-client
      
      
         org.springframework.boot
         spring-boot-starter-actuator
      
      
         org.springframework.boot
         spring-boot-starter-test
         test
      
      
         org.springframework.cloud
         spring-cloud-starter-bus-kafka
      

      
         org.springframework.cloud
         spring-cloud-starter-stream-kafka
      

      
         org.springframework.cloud
         spring-cloud-bus
      
      
         org.springframework.cloud
         spring-cloud-config-monitor
      
   

   
      
         
            org.springframework.cloud
            spring-cloud-dependencies
            ${spring-cloud.version}
            pom
            import
         
      
   

   
      
         
            org.springframework.boot
            spring-boot-maven-plugin
         
      
   

   
      
         spring-snapshots
         Spring Snapshots
         https://repo.spring.io/snapshot
         
            true
         
      
      
         spring-milestones
         Spring Milestones
         https://repo.spring.io/milestone
      
   
   
      
         spring-snapshots
         Spring Snapshots
         https://repo.spring.io/snapshot
         
            true
         
      
      
         spring-milestones
         Spring Milestones
         https://repo.spring.io/milestone
      
   



配置:
server:
  port: 8088

eureka:
  client:
    service-url:
      defaultZone: http://10.130.216.104:8761/eureka
  instance:
      prefer-ip-address: true
      instance-id: ${spring.cloud.client.ipAddress}:${server.port}
spring:
  application:
    name: config-server
  cloud:
    config:
      server:
        git:
          uri: http://gitlab.it.xxx.com/xxx/config-repo.git
          username: xxx
          password: xxx
          basedir: ./gitbasedir
    client:
      ipAddress: 10.141.6.1
    bus:
      refresh:
        enabled: true
  kafka:
    bootstrap-servers: 10.130.216.101:8013
    consumer:
      group-id: config-dev
management:
  endpoints:
    web:
      exposure:
        include: '*'

 

client:


    org.springframework.cloud
    spring-cloud-starter-bus-kafka
spring:
  application:
    name: scrmzqs
  cloud:
    config:
      profile: local
      discovery:
        enabled: true
        service-id: config-server
    bus:
      refresh:
        enabled: true
    client:
      ipAddress: 10.141.6.1
  kafka:
    bootstrap-servers: 10.130.216.101:8013
eureka:
  client:
    service-url:
      defaultZone: http://10.130.216.104:8761/eureka/
  instance:
      prefer-ip-address: true
      instance-id: ${spring.cloud.client.ipAddress}:${server.port}

management:
  endpoints:
    web:
      exposure:
        include: '*'

你可能感兴趣的:(spring cloud bus + kafka 实现配置热更新)