Debug - Nacos - 设置Nacos为配置中心无效

回到顶部(go to top)

场景描述

引入该依赖后,nacos作为配置中心不起作用....

背景:

  • spring-cloud版本: 2020.0.3
  • spring-boot版本:2.5.3
<!-- Nacos作为配置中心 -->
        <dependency>
            <groupId>com.alibaba.cloud</groupId>
            <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
            <version>2.2.0.RELEASE</version>
        </dependency>

 

回到顶部(go to top)

注意

本人使用方法1后,需要重启PC才生效!!!

 

回到顶部(go to top)

方法1:降版本

可以正常使用的版本组合为:
[更新于:2021.08.25 18:30]

  • Spring Cloud:Hoxton.SR4;
  • Spring Boot:2.2.5.RELEASE;
  • MyBatis Plus:3.3.2;
  • JDK:1.8.0_161;
  • NACOS:2.2.0.RELEASE。

 

参考:https://blog.csdn.net/shinyolive/article/details/111402525?utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromMachineLearnPai2%7Edefault-3.base&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromMachineLearnPai2%7Edefault-3.base

 

回到顶部(go to top)

方法2:引入bootstrap依赖

翻看SpringCloud2020的官方文档,发现果然是springcloud2020的原因。

还是引入依赖解决问题

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

引入以上依赖。完美解决问题

参考:https://www.cnblogs.com/xidianzxm/p/14343371.html

 

posted on   frank_cui  阅读(1006)  评论(1编辑  收藏  举报

编辑推荐:
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

导航

统计

levels of contents
点击右上角即可分享
微信分享提示