springcloudAlibaba2025.0.0.0组件版本对应关系

一、父模块

1、Spring Cloud alibaba

bash 复制代码
<dependency>
	<groupId>com.alibaba.cloud</groupId>
	<artifactId>spring-cloud-alibaba-dependencies</artifactId>
	<version>2025.0.0.0</version>
	<type>pom</type>
	<scope>import</scope>
</dependency>

<dependency>
	<groupId>org.springframework.cloud</groupId>
	<artifactId>spring-cloud-dependencies</artifactId>
	<version>2025.0.0</version>
	<type>pom</type>
	<scope>import</scope>
</dependency>

2、SpringBoot

bash 复制代码
<dependency>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-parent</artifactId>
	<version>3.5.5</version>
	<type>pom</type>
	<scope>import</scope>
</dependency>

3、swagger

这是SpringBoot3 + Knife4j 增强swagger UI,不用再引入springfox-swagger-ui,引入了会冲突。

bash 复制代码
<dependency>
	<groupId>com.github.xiaoymin</groupId>
	<artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
	<version>4.5.0</version>
</dependency>

4、数据库连接池

bash 复制代码
<dependency>
	<groupId>com.alibaba</groupId>
	<artifactId>druid-spring-boot-starter</artifactId>
	<version>1.2.20</version>
</dependency>

5、sentinel

bash 复制代码
<dependency>
	<groupId>com.alibaba.cloud</groupId>
	<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
	<version>2025.0.0.0</version>
</dependency>

6、数据库

这个驱动的版本不等同于mysql的版本,8版本的就可以兼容mysql的8版本

bash 复制代码
<dependency>
	<groupId>com.mysql</groupId>
	<artifactId>mysql-connector-j</artifactId>
	<version>8.0.33</version>
</dependency>

7、mybatis-plus

这个一定要用boot3-start 且为3.5.x的版本

bash 复制代码
<dependency>
	<groupId>com.baomidou</groupId>
	<artifactId>mybatis-plus-spring-boot3-starter</artifactId>
	<version>3.5.12</version>
</dependency>

8、通用的依赖(根据需要添加)

bash 复制代码
<!--minio的版本管理-->
<dependency>
	<groupId>io.minio</groupId>
	<artifactId>minio</artifactId>
	<version>8.5.6</version>
</dependency>

<!--influxdb的版本管理-->
<dependency>
	<groupId>com.influxdb</groupId>
	<artifactId>influxdb3-java</artifactId>
	<version>1.10.0</version>
</dependency>

<!--xxl-job的版本管理-->
<dependency>
	<groupId>com.xuxueli</groupId>
	<artifactId>xxl-job-core</artifactId>
	<version>3.4.2</version>
</dependency>

<dependency>
	<groupId>org.projectlombok</groupId>
	<artifactId>lombok</artifactId>
	<version>1.18.30</version>
</dependency>

<dependency>
	<groupId>cn.hutool</groupId>
	<artifactId>hutool-all</artifactId>
	<version>5.8.22</version>
</dependency>

<dependency>
	<groupId>com.alibaba</groupId>
	<artifactId>easyexcel</artifactId>
	<version>3.3.2</version>
</dependency>

<dependency>
	<groupId>com.fasterxml.jackson.core</groupId>
	<artifactId>jackson-annotations</artifactId>
	<version>2.19.2</version>
</dependency>

二、子模块远程RPC调用注意事项

1、依赖引入

若子模块需要用openfeign rpc远程调用相关的东西,则直接在子模块中引入。

bash 复制代码
        <!-- RPC 远程调用相关 -->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-openfeign</artifactId>
            <optional>true</optional>
        </dependency>

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

因为父 pom 已经导入了 Spring Cloud 统一依赖管理(即一、1),不需要单独写 openfeign 版本。

而且一定要引入loadbalancer,因为新版本彻底移除了 Ribbon,Feign 底层默认依赖 Spring Cloud LoadBalancer 做服务实例负载均衡,调用远程接口时会报错:

复制代码
java.lang.IllegalStateException: No LoadBalancer found for service: xxx-service

2、scanBasePackages

如下图所示,一定要写@SpringBootApplication(scanBasePackages = {"com.cloud.zhenyu"}) 这个注解。

scanBasePackages,指定 Spring 自动扫描包范围,默认不写这个的话只扫描当前启动类所在包 + 所有子包,而被调用的api接口不在启动类模块的子包下,所以一定会报错。

而api所在模块与调用者所在模块的包名前缀都一样的,所以这里直接写的com.cloud.zhenyu。

bash 复制代码
Field influxApi in com.cloud.zhenyu.controller.xxxController required a bean of type 'com.cloud.zhenyu.api.InfluxApi' 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 'com.cloud.zhenyu.api.InfluxApi' in your configuration.

3、EnableFeignClients

作用:Spring 默认不会识别 @FeignClient 接口,加上这个注解后,Spring 启动时会扫描指定包下所有标记 @FeignClient 的 RPC 接口,动态生成代理实现类,注入 Spring 容器成为 Bean,供你 @Autowired 注入调用。

搭配 scanBasePackages /basePackages 跨模块扫描。

相关推荐
jonyleek5 天前
JVS数字底座私有化部署实践:Spring Cloud + K8S 实现文档平台开箱即用
elasticsearch·kubernetes·私有化部署·springcloud·minio·jvs企业文档·文档治理
ab12376811 天前
MyBatis-Plus 知识点整理
mybatis-plus
LQQrk智能排产物联网规则引擎11 天前
规则上线从3天到3分钟:JVS-Rules热更新实践——基于Spring Cloud的无重启规则发布方案
springcloud·微服务架构·热更新·规则引擎·灰度发布·jvs-rules·规则测试
Java成神之路-12 天前
深入理解 Spring Cloud Gateway、Nacos 与 OpenFeign:核心原理与协作流程全解析
springcloud
wewowilling13 天前
认识微服务
java·运维·微服务·springcloud
欢醉18 天前
基于日志的监控告警:我们是怎么用一套轻量方案把线上问题"盯"住的
elasticsearch·springcloud·日志
叶总没有会25 天前
OpenFeign
java·开发语言·springcloud·openfeign
欢醉1 个月前
踩坑记:一次Nacos客户端偶发connect timed out全链路排查
nacos·springcloud
豆角焖肉1 个月前
MyBatis-Plus 从入门到 CRUD 实战:Spring Boot 整合
mybatis-plus
小小谈电商1 个月前
大型集团级 B2B2C 商城落地|微服务高并发电商系统实践复盘
springcloud·商城源码选型·微服务电商·b2b2c商城·集团电商