记录一下 Spring Boot 各版本与 JDK、Spring Cloud、Spring Cloud Alibaba 的版本对应关系,方便后续搭建项目时查询。
Spring Boot 与 JDK 版本对应关系
| Spring Boot 版本 | JDK 最低版本 | JDK 最高版本 | 推荐版本 | 状态 |
|---|---|---|---|---|
| 4.0.x | 17 | 25 | 21/25 | 最新稳定版 |
| 3.5.x | 17 | 22 | 17/21 | 稳定版 |
| 3.2.x - 3.4.x | 17 | 22 | 17/21 | 维护中 |
| 2.7.x | 8 | 19 | 11/17 | 停止维护 |
| 2.6.x | 8 | 17 | 8/11 | 停止维护 |
| 2.5.x | 8 | 17 | 8/11 | 停止维护 |
注意:Spring Boot 3.x 和 4.x 都要求最低 JDK 17。
Spring Boot 与 Spring Cloud 版本对应关系
| Spring Cloud 版本 | 代号 | Spring Boot 版本 | 维护状态 |
|---|---|---|---|
| 2023.0.x | 2023.0.x | 3.2.x | 维护中 |
| 2022.0.x | Kilburn | 3.0.x | 维护中 |
| 2021.0.x | Jubilee | 2.6.x, 2.7.x | 停止维护 |
| 2020.0.x | Ilford | 2.4.x, 2.5.x | 停止维护 |
| Hoxton | Hoxton | 2.2.x, 2.3.x | 停止维护 |
| Greenwich | Greenwich | 2.1.x | 停止维护 |
| Finchley | Finchley | 2.0.x | 停止维护 |
| Edgware | Edgware | 1.5.x | 停止维护 |
| Dalston | Dalston | 1.5.x | 停止维护 |
Spring Cloud Alibaba 与 Spring Boot/Spring Cloud 版本对应关系
适配 Spring Boot 3.x 的版本
| Spring Cloud Alibaba | Spring Cloud | Spring Boot | 组件版本 |
|---|---|---|---|
| 2022.0.0.0 | 2022.0.0 | 3.0.2 | Sentinel 1.8.6, Nacos 2.2.1, Seata 1.7.0 |
| 2022.0.0.0-RC2 | 2022.0.0 | 3.0.2 | Sentinel 1.8.6, Nacos 2.2.1, Seata 1.7.0-native |
| 2022.0.0.0-RC1 | 2022.0.0 | 3.0.0 | Sentinel 1.8.6, Nacos 2.2.1-RC |
适配 Spring Boot 2.x 的版本
| Spring Cloud Alibaba | Spring Cloud | Spring Boot | 组件版本 |
|---|---|---|---|
| 2021.0.5.0 | 2021.0.x | 2.6.x - 2.7.x | Sentinel 1.8.6, Nacos 2.2.0 |
| 2021.0.4.0 | 2021.0.x | 2.6.x - 2.7.x | Sentinel 1.8.5, Nacos 2.1.0 |
| 2.2.8.RELEASE | Hoxton | 2.3.x | Sentinel 1.8.2, Nacos 1.4.2 |
| 2.2.7.RELEASE | Hoxton | 2.3.x | Sentinel 1.8.1, Nacos 1.4.1 |
常用版本组合推荐
新项目推荐(2026年)
组合一(稳定主流):
- JDK 17
- Spring Boot 3.5.x
- Spring Cloud 2023.0.x
- Spring Cloud Alibaba 2022.0.0.0
组合二(最新特性):
- JDK 21
- Spring Boot 4.0.x
- Spring Cloud 2023.0.x(需要确认 Spring Cloud Alibaba 兼容性)
老项目维护
组合三(平滑升级):
- JDK 17
- Spring Boot 2.7.x
- Spring Cloud 2021.0.x
- Spring Cloud Alibaba 2021.0.5.0
官方文档链接
Spring Boot
系统要求:
版本选择参考:
- Spring Boot 官方文档:https://docs.spring.io/spring-boot/docs/current/reference/html/
- Spring Boot 发布仓库:https://github.com/spring-projects/spring-boot
Spring Cloud
版本兼容性:
Spring Cloud Alibaba
版本说明:
- Spring Cloud Alibaba 官方文档
- Spring Cloud Alibaba GitHub
- Spring Cloud Alibaba 官网:https://sca.aliyun.com/
注意事项
- Spring Boot 3.x 最低要求 JDK 17,不再支持 JDK 8
- Spring Boot 3.x 使用 Jakarta EE 9+,包名从 javax. 改为 jakarta.
- Spring Cloud Alibaba 版本命名从 2022.x 开始调整,前三位对应 Spring Cloud 版本
- 选择版本时要注意各组件的兼容性,避免版本冲突
版本查询方法
查看当前项目版本
# Maven 项目
mvn dependency:tree
# 查看 Spring Boot 版本
mvn help:evaluate -Dexpression=spring-boot.version -q -DforceStdout使用 Spring Initializr
访问 https://start.spring.io/ 可以自动匹配兼容的版本组合。
Maven 配置示例
Spring Boot 3.5 + Spring Cloud 2023.0.x
<properties>
<java.version>17</java.version>
<spring-boot.version>3.5.0</spring-boot.version>
<spring-cloud.version>2023.0.0</spring-cloud.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>添加 Spring Cloud Alibaba
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
<version>2022.0.0.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>版本对应关系就记录到这里,后续版本更新时再补充。