目前 Spring Boot 框架的版本主要有以下三个系列可选择(截至到2023年8月28日):

  • 3.1.x系列(当前最新为3.1.3)
  • 3.0.x系列(当前最新为3.0.10)
  • 2.7.x系列(当前最新为2.7.15)

那么以上三个系列该如何选择呢?

我们先来看看每个系列的差别有哪些。

1. 技术支持时长

image.png

可以看到,2.7.x系列的官方技术支持截止到2023-11-18,3.0.x系列截止到2023-11-24,3.2.x系列截止到2024-11-23。


2. 系统要求

Spring Boot 2.7.x requires Java 8 and is compatible up to and including Java 20. Spring Framework 5.3.29 or above is also required.

Explicit build support is provided for the following build tools:

Build ToolVersion
Maven3.5+
Gradle6.8.x, 6.9.x, 7.x, and 8.x

Spring Boot 3.0.x requires Java 17 and is compatible up to and including Java 20. Spring Framework 6.0.11 or above is also required.

Explicit build support is provided for the following build tools:

Build ToolVersion
Maven3.5+
Gradle7.x (7.5 or later) and 8.x

Spring Boot 3.1.x requires Java 17 and is compatible up to and including Java 20. Spring Framework 6.0.11 or above is also required.

Explicit build support is provided for the following build tools:

Build ToolVersion
Maven3.6.3 or later
Gradle7.x (7.5 or later) and 8.x

2.1 Servlet Containers

Spring Boot 2.7.x supports the following embedded servlet containers:

NameServlet Version
Tomcat 9.04.0
Jetty 9.43.1
Undertow 2.04.0

You can also deploy Spring Boot applications to any Servlet 3.1 or 4.0 compatible container.

Spring Boot 3.0.x supports the following embedded servlet containers:

NameServlet Version
Tomcat 10.16.0
Jetty 11.05.0
Undertow 2.36.0

You can also deploy Spring Boot applications to any servlet 5.0+ compatible container.

Spring Boot 3.1.x supports the following embedded servlet containers:

NameServlet Version
Tomcat 10.16.0
Jetty 11.05.0
Undertow 2.36.0

You can also deploy Spring Boot applications to any servlet 5.0+ compatible container.

参考官网 spring.io/projects/spring-boot#learn


综上所述,根据官方技术支持的时长限制,如果是新建项目,建议使用3.1.x系列版本进行开发,如果是现有项目,请注意框架版本所支持的最长支持时间,最长使用时间不宜超过社区维护的时间,否则安全风险难以控制。


竹影清风
1 声望0 粉丝

IT打工人