美文网首页程序员
@RefreshScope不生效解决办法

@RefreshScope不生效解决办法

作者: 一枚路过的程序猿 | 来源:发表于2020-07-01 16:01 被阅读0次

采用版本

nacos:2.2.1.RELEASE

@RefreshScope不能加在启动类,只能加在需要动态配置类上,同时需引入动态刷新配置,忽略权限拦截

spring:
  application:
    name: anyouliang-user
  cloud:
    nacos:
      config:
        server-addr: 192.168.101.22:8848,192.168.101.23:8848,192.168.101.24:8848
        namespace: 8d4e6351-80a8-45f6-b120-3acc4c5cbf2b
        file-extension: yml
        group: user-service
        username: nacos
        password: nacos

#动态刷新配置 ---需要忽略权限拦截
management:
  endpoints:
    web:
      exposure:
        include: refresh

相关文章

网友评论

    本文标题:@RefreshScope不生效解决办法

    本文链接:https://www.haomeiwen.com/subject/rnlofktx.html