Spring Cloud和SpringBoot版本对应关系?头脑导图 代码示例(java 架构) ...

打印 上一主题 下一主题

主题 937|帖子 937|积分 2811

Spring Cloud 和 Spring Boot 的版本之间存在肯定的对应关系,因为 Spring Cloud 依靠于 Spring Boot 提供的底子功能。通常情况下,每个重要版本的 Spring Cloud 都是与特定版本范围的 Spring Boot 兼容的。以下是截至2024年12月的最新版本信息和一个简化的关系图。
Spring Cloud 和 Spring Boot 版本对应关系

简化的关系图

  1. Spring Ecosystem Version Compatibility
  2. ├── Spring Boot
  3. │   ├── 3.2.x (Train Milestone/Release)
  4. │   └── 3.1.x (LTS, Long Term Support)
  5. └── Spring Cloud
  6.     ├── 2023.0.x (Eureka SRx) - 对应 Spring Boot 3.2.x
  7.     ├── 2022.0.x (Gateway SRx) - 对应 Spring Boot 3.1.x
  8.     └── 更早版本(如2021.0.x)- 对应更早版本的 Spring Boot
复制代码
请注意,Spring Cloud 的版本定名从2020年开始利用了新的定名方案,不再以字母表次序定名(如 Hoxton, Ilford 等),而是采用了基于年份的定名方式(如 2021.0.x, 2022.0.x)。同时,Spring Boot 也有了自己的长期支持(LTS)版本,比方 3.1.x 是当前的 LTS 版本。
如何确定兼容性

为了确保你选择的 Spring Cloud 和 Spring Boot 版本兼容,你应该:

  • 检察官方文档或发布阐明,那里会明确指出哪个版本的 Spring Cloud 支持哪些版本的 Spring Boot。
  • 利用 Spring Initializr (https://start.spring.io/) 来创建项目时,它会自动为你选择符合的版本组合。
  • 如果手动管理依靠,请参考 spring-cloud-dependencies BOM 文件中的设置,该文件定义了全部 Spring Cloud 组件及其依靠的版本。
示例代码

对于最新的 Spring Boot 3.2.x 和 Spring Cloud 2023.0.x (Eureka SRx),你的 Maven pom.xml 可能看起来像这样:
  1. <parent>
  2.     <groupId>org.springframework.boot</groupId>
  3.     <artifactId>spring-boot-starter-parent</artifactId>
  4.     <version>3.2.0</version> <!-- 或者使用具体的子版本 -->
  5.     <relativePath/> <!-- lookup parent from repository -->
  6. </parent>
  7. <dependencyManagement>
  8.     <dependencies>
  9.         <dependency>
  10.             <groupId>org.springframework.cloud</groupId>
  11.             <artifactId>spring-cloud-dependencies</artifactId>
  12.             <version>2023.0.0</version> <!-- 或者使用具体的子版本 -->
  13.             <type>pom</type>
  14.             <scope>import</scope>
  15.         </dependency>
  16.     </dependencies>
  17. </dependencyManagement>
  18. <dependencies>
  19.     <!-- 添加你需要的 Spring Boot 和 Spring Cloud Starter -->
  20.     <dependency>
  21.         <groupId>org.springframework.boot</groupId>
  22.         <artifactId>spring-boot-starter-web</artifactId>
  23.     </dependency>
  24.     <dependency>
  25.         <groupId>org.springframework.cloud</groupId>
  26.         <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
  27.     </dependency>
  28.     <!-- 其他依赖... -->
  29. </dependencies>
复制代码
这段设置将确保你利用的 Spring Cloud 和 Spring Boot 版本是兼容的,并且可以或许获取到最新的安全更新和功能改进。
请根据实际需要调整版本号,以及添加或移除其他须要的依靠项。

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

徐锦洪

金牌会员
这个人很懒什么都没写!
快速回复 返回顶部 返回列表