时间:2022-10-25 09:32:28 | 栏目:JAVA代码 | 点击:次

<packaging>pom</packaging>
造成的,删除问题解决~
由于最近项目需要打包成docker部署到测试服务器,公司统一使用一个nacos作为配置中心,一直不能加载bootstrap.yml文件报配置找不到。是由于没有加载nacos-config依赖。

加上这个依赖,要注意的是,springboot 版本 跟nacos-config 要对应 譬如 springboot版本是 2.x.x 的, nacos 的需要也是 2.x.x

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.2.RELEASE</version>
<relativePath/>
</parent>
<dependencies>
<!--nacos配置中心-->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
<version>2.2.1.RELEASE</version>
</dependency>
</dependencies>