Spring Boot、Spring Cloud与Spring Cloud Alibaba版本对应关系

简介: Spring Boot、Spring Cloud与Spring Cloud Alibaba版本对应关系

一、前言

在搭建SpringCloud项目环境架构的时候,经常需要选择SpringBoot和SpringCloud进行兼容的版本号。因此,对于选择SpringBoot版本与SpringCloud版本的对应关系很重要,如果版本关系不对应,常见的会遇见项目启动不起来,怪异的则会是你的项目出现一些诡异的问题,查资料也不好查。下面就收集一下SpringBoot与SpringCloud版本之间的对应关系,在搭建项目框架或者学习时按照对应的版本区间进行选择即可,避免走一些不必要的弯路。

1. 历史版本图

Release train Spring Boot compatibility

注意: 官方通告SpringBoot1.5.x及以下版本官方不再提供维护了,建议开发者选择使用SpringBoot2.0.x以上的版本,相对应的SpringCloud版本也最好不要使用。

二、查看版本关系

访问Spring官方地址,可获取SpringBoot和SpringCloud版本对应信息。

地址如下:

https://start.spring.io/actuator/info

JSON格式如下:

{
"git": {
"branch": "aa1ad68ea9a0eac4180037118854753f3e200e85",
"commit": {
"id": "aa1ad68",
"time": "2023-03-10T15:26:12Z"
}
},
"build": {
"version": "0.0.1-SNAPSHOT",
"artifact": "start-site",
"versions": {
"spring-boot": "3.0.2",
"initializr": "0.20.0-SNAPSHOT"
},
"name": "start.spring.io website",
"time": "2023-03-10T15:27:19.222Z",
"group": "io.spring.start"
},
"bom-ranges": {
"codecentric-spring-boot-admin": {
"2.4.3": "Spring Boot >=2.3.0.M1 and <2.5.0-M1",
"2.5.6": "Spring Boot >=2.5.0.M1 and <2.6.0-M1",
"2.6.8": "Spring Boot >=2.6.0.M1 and <2.7.0-M1",
"2.7.4": "Spring Boot >=2.7.0.M1 and <3.0.0-M1",
"3.0.0-M4": "Spring Boot >=3.0.0-M1 and <3.1.0-M1"
},
"solace-spring-boot": {
"1.1.0": "Spring Boot >=2.3.0.M1 and <2.6.0-M1",
"1.2.2": "Spring Boot >=2.6.0.M1 and <3.0.0-M1"
},
"solace-spring-cloud": {
"1.1.1": "Spring Boot >=2.3.0.M1 and <2.4.0-M1",
"2.1.0": "Spring Boot >=2.4.0.M1 and <2.6.0-M1",
"2.3.2": "Spring Boot >=2.6.0.M1 and <3.0.0-M1"
},
"spring-cloud": {
"Hoxton.SR12": "Spring Boot >=2.2.0.RELEASE and <2.4.0.M1",
"2020.0.6": "Spring Boot >=2.4.0.M1 and <2.6.0-M1",
"2021.0.0-M1": "Spring Boot >=2.6.0-M1 and <2.6.0-M3",
"2021.0.0-M3": "Spring Boot >=2.6.0-M3 and <2.6.0-RC1",
"2021.0.0-RC1": "Spring Boot >=2.6.0-RC1 and <2.6.1",
"2021.0.6": "Spring Boot >=2.6.1 and <3.0.0-M1",
"2022.0.0-M1": "Spring Boot >=3.0.0-M1 and <3.0.0-M2",
"2022.0.0-M2": "Spring Boot >=3.0.0-M2 and <3.0.0-M3",
"2022.0.0-M3": "Spring Boot >=3.0.0-M3 and <3.0.0-M4",
"2022.0.0-M4": "Spring Boot >=3.0.0-M4 and <3.0.0-M5",
"2022.0.0-M5": "Spring Boot >=3.0.0-M5 and <3.0.0-RC1",
"2022.0.0-RC1": "Spring Boot >=3.0.0-RC1 and <3.0.0-RC2",
"2022.0.0-RC2": "Spring Boot >=3.0.0-RC2 and <3.0.0",
"2022.0.1": "Spring Boot >=3.0.0 and <3.1.0-M1"
},
"spring-cloud-azure": {
"4.6.0": "Spring Boot >=2.5.0.M1 and <3.0.0-M1",
"5.0.0": "Spring Boot >=3.0.0-M1 and <3.1.0-M1"
},
"spring-cloud-gcp": {
"2.0.11": "Spring Boot >=2.4.0-M1 and <2.6.0-M1",
"3.4.6": "Spring Boot >=2.6.0-M1 and <3.0.0-M1",
"4.1.2": "Spring Boot >=3.0.0-M1 and <3.1.0-M1"
},
"spring-cloud-services": {
"2.3.0.RELEASE": "Spring Boot >=2.3.0.RELEASE and <2.4.0-M1",
"2.4.1": "Spring Boot >=2.4.0-M1 and <2.5.0-M1",
"3.3.0": "Spring Boot >=2.5.0-M1 and <2.6.0-M1",
"3.4.0": "Spring Boot >=2.6.0-M1 and <2.7.0-M1",
"3.5.0": "Spring Boot >=2.7.0-M1 and <3.0.0-M1",
"4.0.0": "Spring Boot >=3.0.0 and <3.1.0-M1"
},
"spring-shell": {
"2.1.6": "Spring Boot >=2.7.0 and <3.0.0-M1",
"3.0.0": "Spring Boot >=3.0.0 and <3.1.0-M1"
},
"vaadin": {
"14.9.6": "Spring Boot >=2.1.0.RELEASE and <2.6.0-M1",
"23.2.15": "Spring Boot >=2.6.0-M1 and <2.7.0-M1",
"23.3.5": "Spring Boot >=2.7.0-M1 and <3.0.0-M1",
"24.0.0": "Spring Boot >=3.0.0-M1 and <3.1.0-M1"
},
"hilla": {
"1.3.5": "Spring Boot >=2.7.0-M1 and <3.0.0-M1",
"2.0.0": "Spring Boot >=3.0.0-M1 and <3.1.0-M1"
},
"wavefront": {
"2.0.2": "Spring Boot >=2.1.0.RELEASE and <2.4.0-M1",
"2.1.1": "Spring Boot >=2.4.0-M1 and <2.5.0-M1",
"2.2.2": "Spring Boot >=2.5.0-M1 and <2.7.0-M1",
"2.3.4": "Spring Boot >=2.7.0-M1 and <3.0.0-M1",
"3.0.1": "Spring Boot >=3.0.0-M1 and <3.1.0-M1"
}
},
"dependency-ranges": {
"okta": {
"1.4.0": "Spring Boot >=2.2.0.RELEASE and <2.4.0-M1",
"1.5.1": "Spring Boot >=2.4.0-M1 and <2.4.1",
"2.0.1": "Spring Boot >=2.4.1 and <2.5.0-M1",
"2.1.6": "Spring Boot >=2.5.0-M1 and <3.0.0-M1",
"3.0.3": "Spring Boot >=3.0.0-M1 and <3.1.0-M1",
"managed": "Spring Boot >=3.1.0-M1"
},
"mybatis": {
"2.1.4": "Spring Boot >=2.1.0.RELEASE and <2.5.0-M1",
"2.2.2": "Spring Boot >=2.5.0-M1 and <2.7.0-M1",
"2.3.0": "Spring Boot >=2.7.0-M1 and <3.0.0-M1",
"3.0.0": "Spring Boot >=3.0.0-M1"
},
"camel": {
"3.5.0": "Spring Boot >=2.3.0.M1 and <2.4.0-M1",
"3.10.0": "Spring Boot >=2.4.0.M1 and <2.5.0-M1",
"3.13.0": "Spring Boot >=2.5.0.M1 and <2.6.0-M1",
"3.17.0": "Spring Boot >=2.6.0.M1 and <2.7.0-M1",
"3.20.2": "Spring Boot >=2.7.0.M1 and <3.0.0-M1",
"4.0.0-M2": "Spring Boot >=3.0.0-M1 and <3.1.0-M1"
},
"picocli": {
"4.7.0": "Spring Boot >=2.5.0.RELEASE and <3.1.0-M1"
},
"open-service-broker": {
"3.2.0": "Spring Boot >=2.3.0.M1 and <2.4.0-M1",
"3.3.1": "Spring Boot >=2.4.0-M1 and <2.5.0-M1",
"3.4.1": "Spring Boot >=2.5.0-M1 and <2.6.0-M1",
"3.5.0": "Spring Boot >=2.6.0-M1 and <2.7.0-M1"
}
}
}

三、如何选择SpringBoot与SpringCloud版本号

项目搭建初期,如何对SpringBoot和SpringCloud的一个相互兼容性版本号进行选择,这是很重要的一步,例如SpringCloud的Hoxton.SR3这个版本,他对应的"Spring Boot >=2.2.0.M4 and <2.3.0.BUILD-SNAPSHOT"版本,意思就是如果选择使用SpringCloud 的Hoxton.SR3这个版本,那么SpringBoot的版本需要大于等于2.2.0小于2.3.0即可满足兼容性。

1. 引入SpringCloud版本管理

官方提供了管理Spring Cloud 每个版本兼容的pom,引入下面依赖管理信息即可:

<dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>Hoxton.SR3</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
 </dependencyManagement>
2. 使用Spring Boot

Spring Boot可以也像父工程那样管理自己内部的兼容版本号,如下:

<parent>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-parent</artifactId>
   <version>2.2.5.RELEASE</version>
   <relativePath/> <!-- lookup parent from repository -->
</parent>

四、SpringBoot、SpringCloud、SpringCloudAlibaba版本对应关系

由于Spring Cloud基于Spring Boot构建,而Spring Cloud Alibaba又基于Spring Cloud Common的规范实现,所以当我们使用``Spring Cloud Alibaba`来构建微服务应用的时候,需要知道这三者之间的版本关系。

下表整理了目前Spring Cloud Alibaba的版本与Spring Boot、Spring Cloud版本的兼容关系:

1. 毕业版本依赖关系(推荐使用)

五. Spring Cloud Alibaba与组件版本关系

Spring Cloud Alibaba是基于Spring Cloud Common的规范实现,而Spring Cloud Alibaba的各个微服务组件依赖于Spring Cloud Alibaba自身,因此我们需要知道Spring Cloud Alibaba与其自身微服务组件之间的版本关系。

下表整理了目前Spring Cloud Alibaba的版本与Sentinel、Nacos 、RocketMQ 、Dubbo、Seata版本的兼容关系:

1. 组件版本关系

六、依赖管理

Spring Cloud Alibaba BOM 包含了它所使用的所有依赖的版本。

1. RELEASE 版本

Spring Cloud Hoxton

如果需要使用 Spring Cloud Hoxton 版本,请在 dependencyManagement中添加如下配置

<dependency>
    <groupId>com.alibaba.cloud</groupId>
    <artifactId>spring-cloud-alibaba-dependencies</artifactId>
    <version>2.2.3.RELEASE</version>
    <type>pom</type>
    <scope>import</scope>
</dependency>

然后在dependencies 中添加自己所需使用的依赖即可使用。

Spring Cloud Greenwich

如果需要使用 Spring Cloud Greenwich版本,请在 dependencyManagement中添加如下配置

<dependency>
    <groupId>com.alibaba.cloud</groupId>
    <artifactId>spring-cloud-alibaba-dependencies</artifactId>
    <version>2.1.3.RELEASE</version>
    <type>pom</type>
    <scope>import</scope>
</dependency>

然后在 dependencies中添加自己所需使用的依赖即可使用。

Spring Cloud Finchley

如果需要使用 Spring Cloud Finchley版本,请在 dependencyManagement中添加如下配置

<dependency>
    <groupId>com.alibaba.cloud</groupId>
    <artifactId>spring-cloud-alibaba-dependencies</artifactId>
    <version>2.0.3.RELEASE</version>
    <type>pom</type>
    <scope>import</scope>
</dependency>

然后在dependencies中添加自己所需使用的依赖即可使用。

Spring Cloud Edgware

如果需要使用 Spring Cloud Edgware 版本,请在 dependencyManagement中添加如下配置

<dependency>
    <groupId>com.alibaba.cloud</groupId>
    <artifactId>spring-cloud-alibaba-dependencies</artifactId>
    <version>1.5.1.RELEASE</version>
    <type>pom</type>
    <scope>import</scope>
</dependency>

然后在 dependencies中添加自己所需使用的依赖即可使用。

2. 版本管理规范

项目的版本号格式为 x.x.x 的形式,其中 x 的数值类型为数字,从 0 开始取值,且不限于 0~9 这个范围。项目处于孵化器阶段时,第一位版本号固定使用 0,即版本号为 0.x.x 的格式。

由于 `Spring Boot 1 和 Spring Boot 2 在 Actuator 模块的接口和注解有很大的变更,且 spring-cloud-commons 从 1.x.x 版本升级到 2.0.0 版本也有较大的变更,因此我们采取跟 SpringBoot 版本号一致的版本:

1.5.x 版本适用于 Spring Boot 1.5.x

2.0.x 版本适用于 Spring Boot 2.0.x

2.1.x 版本适用于 Spring Boot 2.1.x

2.2.x 版本适用于 Spring Boot 2.2.x

七、参考文档

1.Spring-Cloud-Alibaba版本说明:

https://github.com/alibaba/spring-cloud-alibaba/wiki/版本说明

3.SpringCloudAlibaba中文社区地址:

https://github.com/alibaba/spring-cloud-alibaba/blob/master/README-zh.md

2.SpringCloud官方文档:

https://cloud.spring.io/spring-cloud-static/spring-cloud-gateway/2.2.1.RELEASE/reference/html/

目录
相关文章
|
26天前
|
前端开发 JavaScript Java
springboot图书馆管理系统前后端分离版本
springboot图书馆管理系统前后端分离版本
39 12
|
21天前
|
监控 Java 应用服务中间件
SpringBoot是如何简化Spring开发的,以及SpringBoot的特性以及源码分析
Spring Boot 通过简化配置、自动配置和嵌入式服务器等特性,大大简化了 Spring 应用的开发过程。它通过提供一系列 `starter` 依赖和开箱即用的默认配置,使开发者能够更专注于业务逻辑而非繁琐的配置。Spring Boot 的自动配置机制和强大的 Actuator 功能进一步提升了开发效率和应用的可维护性。通过对其源码的分析,可以更深入地理解其内部工作机制,从而更好地利用其特性进行开发。
42 6
|
1月前
|
缓存 安全 Java
Spring Boot 3 集成 Spring Security + JWT
本文详细介绍了如何使用Spring Boot 3和Spring Security集成JWT,实现前后端分离的安全认证概述了从入门到引入数据库,再到使用JWT的完整流程。列举了项目中用到的关键依赖,如MyBatis-Plus、Hutool等。简要提及了系统配置表、部门表、字典表等表结构。使用Hutool-jwt工具类进行JWT校验。配置忽略路径、禁用CSRF、添加JWT校验过滤器等。实现登录接口,返回token等信息。
345 12
|
30天前
|
人工智能 安全 Java
AI 时代:从 Spring Cloud Alibaba 到 Spring AI Alibaba
本次分享由阿里云智能集团云原生微服务技术负责人李艳林主讲,主题为“AI时代:从Spring Cloud Alibaba到Spring AI Alibaba”。内容涵盖应用架构演进、AI agent框架发展趋势及Spring AI Alibaba的重磅发布。分享介绍了AI原生架构与传统架构的融合,强调了API优先、事件驱动和AI运维的重要性。同时,详细解析了Spring AI Alibaba的三层抽象设计,包括模型支持、工作流智能体编排及生产可用性构建能力,确保安全合规、高效部署与可观测性。最后,结合实际案例展示了如何利用私域数据优化AI应用,提升业务价值。
123 4
|
1月前
|
存储 安全 Java
Spring Boot 3 集成Spring AOP实现系统日志记录
本文介绍了如何在Spring Boot 3中集成Spring AOP实现系统日志记录功能。通过定义`SysLog`注解和配置相应的AOP切面,可以在方法执行前后自动记录日志信息,包括操作的开始时间、结束时间、请求参数、返回结果、异常信息等,并将这些信息保存到数据库中。此外,还使用了`ThreadLocal`变量来存储每个线程独立的日志数据,确保线程安全。文中还展示了项目实战中的部分代码片段,以及基于Spring Boot 3 + Vue 3构建的快速开发框架的简介与内置功能列表。此框架结合了当前主流技术栈,提供了用户管理、权限控制、接口文档自动生成等多项实用特性。
81 8
|
1月前
|
人工智能 自然语言处理 Java
Spring Cloud Alibaba AI 入门与实践
本文将介绍 Spring Cloud Alibaba AI 的基本概念、主要特性和功能,并演示如何完成一个在线聊天和在线画图的 AI 应用。
346 7
|
负载均衡 监控 Java
F版本SpringCloud 2—什么是SpringCloud?SpringCloud版本选择
引言:搭建微服务架构就像是买电脑,使用SpringCloud就是在买品牌机。
|
27天前
|
XML Java 应用服务中间件
Spring Boot 两种部署到服务器的方式
本文介绍了Spring Boot项目的两种部署方式:jar包和war包。Jar包方式使用内置Tomcat,只需配置JDK 1.8及以上环境,通过`nohup java -jar`命令后台运行,并开放服务器端口即可访问。War包则需将项目打包后放入外部Tomcat的webapps目录,修改启动类继承`SpringBootServletInitializer`并调整pom.xml中的打包类型为war,最后启动Tomcat访问应用。两者各有优劣,jar包更简单便捷,而war包适合传统部署场景。需要注意的是,war包部署时,内置Tomcat的端口配置不会生效。
201 17
Spring Boot 两种部署到服务器的方式
|
27天前
|
Dart 前端开发 JavaScript
springboot自动配置原理
Spring Boot 自动配置原理:通过 `@EnableAutoConfiguration` 开启自动配置,扫描 `META-INF/spring.factories` 下的配置类,省去手动编写配置文件。使用 `@ConditionalXXX` 注解判断配置类是否生效,导入对应的 starter 后自动配置生效。通过 `@EnableConfigurationProperties` 加载配置属性,默认值与配置文件中的值结合使用。总结来说,Spring Boot 通过这些机制简化了开发配置流程,提升了开发效率。
59 17
springboot自动配置原理
|
1月前
|
XML JavaScript Java
SpringBoot集成Shiro权限+Jwt认证
本文主要描述如何快速基于SpringBoot 2.5.X版本集成Shiro+JWT框架,让大家快速实现无状态登陆和接口权限认证主体框架,具体业务细节未实现,大家按照实际项目补充。
80 11