当前位置:   article > 正文

整合Nacos Config启动失败_nacos exception encountered during context initial

nacos exception encountered during context initialization - cancelling refre

报错信息
        Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.testController': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'test' in value "${test}"

版本信息:

组件
版本
spring-cloud-alibaba
2021.0.1.0
spring-boot-starter-parent
2.6.3
nacos
1.4.2

解决办法:

加入依赖

  1. <dependency>
  2. <groupId>org.springframework.cloud</groupId>
  3. <artifactId>spring-cloud-starter-bootstrap</artifactId>
  4. <version>3.1.3</version>
  5. </dependency>

可能的原因:

SpringBoot 2.4之后 spring.cloud.bootstrap.enabled默认为false,没读到bootstrap.yaml里面关于Nacos Config的信息。新加入标识依赖之后,可以正常读取bootstrap.yaml信息

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/IT小白/article/detail/159666
推荐阅读
相关标签
  

闽ICP备14008679号