版
最新版本与兼容性矩阵
Version & Compatibility Matrix
这一页最值钱的一张表。启动报错、NoSuchMethodError、Bean 找不到,九成是版本没对上。Spring Cloud、Spring Cloud Alibaba、Spring Boot 三者必须"三元绑定"——拿一个 Spring Boot 版本,去官方 Release Train 表里反查它配哪个 Spring Cloud,再反查配哪个 Alibaba。下表是当前主流搭配,具体小版本号以 Spring / Spring Cloud Alibaba 官方 Wiki 最新稳定版为准,本表只告诉你大版本怎么搭。
| 组件 | 版本(当前稳定线) | 对应关系 / 说明 |
|---|---|---|
| Spring Boot | 3.2.x / 3.3.x | Spring Cloud 2023.0.x(Leyton)的底座。JDK 17 起。 |
| Spring Cloud | 2023.0.x(Leyton,当前稳定) | 对应 Spring Boot 3.2+。Gateway 4.x、OpenFeign 4.x 都在这条线上。 |
| Spring Cloud | 2024.0.x | 更新的发行列车,跟着更新的 Spring Boot 走。新项目以官网最新稳定版为准,别死背号。 |
| Spring Cloud Alibaba | 2023.0.1.x | 对接 Spring Cloud 2023.0.x + Spring Boot 3.2+,Nacos/Sentinel/Seata starter 都在这线。 |
| Spring Cloud Alibaba | 2023.0.2.x(及更新) | 跟着 Spring Cloud 2023.0.x 小版本迭代,以官方 Wiki 公告为准。 |
| Nacos Server | 2.3.x / 2.4.x | 注册 + 配置中心服务端,client 版本跟 spring-cloud-alibaba 走,别自己乱升。 |
| Sentinel | 1.8.x | 熔断限流核心库,控制台单独下 jar 跑。 |
| Seata | 2.x | 分布式事务 Server(TC),AT 模式。 |
| Gateway | 4.x | 随 Spring Cloud 2023 走,WebFlux 异步。 |
| OpenFeign | 4.x | 随 Spring Cloud 2023 走。 |
三元对应,一张兼容矩阵
把上面那张表压成"配对表",照着抄就不会错:
| Spring Boot | Spring Cloud | Spring Cloud Alibaba |
|---|---|---|
| 3.2.x | 2023.0.x(Leyton) | 2023.0.1.x / 2023.0.2.x |
| 3.3.x | 2023.0.x / 2024.0.x | 对应官方已发布的 Alibaba 线,查 Wiki 确认 |
| 2.7.x(老项目) | 2021.0.x / 2022.0.x | 2021.0.x.5.0(老维护项目才碰,新别用) |
三条铁律
① Spring Cloud 版本必须与 Spring Boot 严格对应——它的 starter 内部直接依赖 Boot 的具体类,差一个次版本就 NoSuchMethodError。② Spring Cloud Alibaba 必须与前两者同时对应——它封装 Nacos/Sentinel 的 starter 又依赖 Spring Cloud 的接口。③ 三个都用 BOM/dependencyManagement 统一管,子模块别再写死版本号。真拿不准,去 Spring Cloud 官方 Wiki "Release Train" 和 spring-cloud-alibaba 官方 Wiki 各查一眼,两表一对就齐活。