美文网首页
Spring Cloud Config client中无法加载b

Spring Cloud Config client中无法加载b

作者: 迷茫中寻找出路 | 来源:发表于2021-01-15 09:39 被阅读0次

    本人使用的SpringCloud config 3.0

    官网描述(百度翻译,有点耐心看完)

    要使用传统的引导方式连接到Config Server,必须通过属性或spring-cloud-starter-bootstrap启动程序启用引导。该属性是spring.cloud.bootstrap.enabled=true。必须将其设置为系统属性或环境变量。启用引导程序后,在类路径上具有Spring Cloud Config Client的任何应用程序都将按以下方式连接到Config Server:启动配置客户端时,它将绑定到Config Server(通过spring.cloud.config.uribootstrap配置属性),并Environment使用远程属性源初始化Spring 。
    
    此行为的最终结果是,所有要使用Config Server的客户端应用程序都需要一个bootstrap.yml(或环境变量),其服务器地址设置为该地址spring.cloud.config.uri(默认为“ http:// localhost:8888”)。
    

    解决办法

    添加依赖
    注意:只要和当前项目有引用关系的必须全部换成bootstrap.yml,要不然会出现当前项目引用其他application.yml

      <dependency>
              <groupId>org.springframework.cloud</groupId>
              <artifactId>spring-cloud-starter-bootstrap</artifactId>
      </dependency>
    

    相关文章

      网友评论

          本文标题:Spring Cloud Config client中无法加载b

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