1、报错:required a bean of type 'org.springframework.cloud.alibaba.nacos.NacosConfigProperties' that could not be found.

      

***************************
APPLICATION FAILED TO START
***************************

Description:

Field nacosConfigProperties in org.springframework.cloud.alibaba.nacos.endpoint.NacosConfigEndpointAutoConfiguration required a bean of type 'org.springframework.cloud.alibaba.nacos.NacosConfigProperties' that could not be found.

The injection point has the following annotations:
    - @org.springframework.beans.factory.annotation.Autowired(required=true)


Action:

Consider defining a bean of type 'org.springframework.cloud.alibaba.nacos.NacosConfigProperties' in your configuration.

原因是 nacos的配置信息只能放在bootstrap.properties 才生效

 2、服务启动后能获取到nacos中配置的信息,但是nacos中更新后,服务获取的还是旧的值

      解决:网上查了各种说法,都没解决问题,最后nacos官网文档中的示例代码,而且是2年前的,下载下来改下配置,一运行就可以了,

springboot 集成 nacos

 

 

 springboot 集成 nacos

经对比发现自己demo里 

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
<version>0.2.1.RELEASE</version>
</dependency>

这个依赖是0.2.0 ,的,改成示例里的0.2.1 的就可以了,,目前发现最新的2.2.2,改成2.2.2的版本也是可以的
那根本的原因其实就是版本的问题,nacos的官方文档中有说明,

springboot 集成 nacos

 


 
                    
            
                

相关文章:

  • 2021-09-30
  • 2022-01-15
  • 2022-01-30
  • 2021-10-29
  • 2022-12-23
  • 2021-12-08
  • 2021-11-07
  • 2021-10-08
猜你喜欢
  • 2021-05-17
  • 2021-05-22
  • 2022-01-23
  • 2021-09-27
  • 2022-12-23
  • 2022-12-23
  • 2021-12-16
相关资源
相似解决方案