weixin_43633155 2020-04-15 00:01 采纳率: 0%
浏览 522
已结题

springcloudbus消息总线远程配置没有自动更新

最近在学习springcloud集成,在看到消息总线这块儿的时候照着网上的方法做了个测试,但是在访问localhost:端口号/actuator/bus-refresh这个接口以后,并没有获取到远程配置的更改,我客户端的controller类,也加了@Rescope这个注解,但是我的服务端的控制台我看返回的是
o.s.cloud.bus.event.RefreshListener : Received remote refresh request. Keys refreshed []
这是不是服务端上就没有获取到更新的意思?
我还要自己在浏览器输入
localhost:12000/base-dev.yml
这个以后,控制台才能获取显示
Fetched for remote master and found 1 updates
好像消息总线服务端压根儿就没有生效,而且我服务端获取了消息后,客户端也没有发生变化,还是需要重启才能重新加载配置更改,请高人指点下,我是不是哪里配置或是依赖错了,谢谢。
我的springboot是2.2.4,springcloud是Hoxton.SR3,不知道是不是跟版本用的太新了有关系,因为配置上实在是看不出问题了,只是不生效,没有任何报错信息
服务端application.yml

server:
  port: 12000
spring:
  application:
    name: bus-server
  cloud:
    config:
      server:
        git:
          uri: ********
          username: ******
          password: ******
  rabbitmq:
    host: 192.168.159.130
    username: guest
    password: guest
#暴露触发消息总线的地址
management:
  endpoints:
    web:
      exposure:
        include: 'bus-refresh'

客户端bootstrap.yml

spring:
  cloud:
    config:
      name: base
      profile: dev
      label: master
      uri: http://127.0.0.1:12000

远程配置文件dev-base.yml

server:
  port: 9001
spring:
  application:
    name: bus-client
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://127.0.0.1:3306/testclient?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8&useSSL=false
    username: root
    password: root
  jpa:
    database: mysql
    show-sql: true
  rabbitmq:
    host: 192.168.159.130
    username: guest
    password: guest
eureka:
  client:
    service-url:
      defaultZone: http://127.0.0.1:6868/eureka/
  instance:
    prefer-ip-address: true

pom.xml

<dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-bus</artifactId>
            <version>2.2.1.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-bus-amqp</artifactId>
            <version>2.2.1.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
  • 写回答

1条回答 默认 最新

  • dabocaiqq 2020-04-15 00:41
    关注
    评论

报告相同问题?

悬赏问题

  • ¥15 运筹学排序问题中的在线排序
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥30 求一段fortran代码用IVF编译运行的结果
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥30 python代码,帮调试,帮帮忙吧
  • ¥15 #MATLAB仿真#车辆换道路径规划