zoukankan      html  css  js  c++  java
  • springboot 集成 nacos

    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年前的,下载下来改下配置,一运行就可以了,

     

     

    经对比发现自己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的官方文档中有说明,

    
    
  • 相关阅读:
    禁止IOS双击上滑
    keychains
    GUID 格式化
    Dart基础使用手册
    关于Android 8.0java.lang.SecurityException: Permission Denial错误的解决方法
    Android开发者的Anko使用指南(四)之Layouts
    Android开发者的Anko使用指南(三)之资源
    Android开发者的Anko使用指南(二)之Dialogs
    Android开发者的Anko使用指南(一)之Intent
    hornor8改user模式为debug模式
  • 原文地址:https://www.cnblogs.com/feiye512/p/14569697.html
Copyright © 2011-2022 走看看