fix: 补充 Nacos 配置与 bootstrap 依赖,使 bootstrap.yml 生效

缺少 spring-cloud-starter-alibaba-nacos-config 与 spring-cloud-starter-bootstrap 时,
bootstrap.yml 在 Boot 2.7/Spring Cloud 2021.x 下被忽略,Nacos 共享配置
(application-infra.yaml 的 mysql 配置)不加载,应用回退 jar 内 localhost:3306 而连接被拒。
This commit is contained in:
chenxing
2026-08-13 12:22:39 +08:00
parent d75e43cb81
commit 00ef5cf0c1
+13
View File
@@ -46,6 +46,19 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<!-- Nacos 配置中心(替代 Spring Cloud Config)。Spring Cloud Alibaba 2021.0.5 适配 Boot 2.7 -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<!-- Boot 2.4+ 默认不再处理 bootstrap.yml,需显式引入以继续从 Nacos 拉取配置 -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bootstrap</artifactId>
<version>3.1.8</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>