一、背景
最近在看 spring security,发现没有一个明确的 springboot 和 spring security 版本的对应关系,由于 spring security 不同版本之间的差异很大,导致写出来的代码不能按照预期的效果展示,所以我就整理了一下两者之间的版本对应关系。
今天是 2021年11月23日,最新稳定版本的 spring boot 是 2.3.12.RELEASE 版本,如果想查看所有的 spring boot 版本,请查询这个地址 。
二、配置相关依赖
在我们的 pom.xml 中,可以通过这种方式引入 spring security 的依赖,如下所示:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com</groupId>
<artifactId>SpringBoot</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>myName</name>
<url>www.funtl.com</url>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.14.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
三、版本对应关系
springboot 版本 | spring security版本 |
2.3.12.RELEASE | 5.3.9.RELEASE |
2.3.11.RELEASE | 5.3.9.RELEASE |
2.3.10.RELEASE | 5.3.9.RELEASE |
2.3.9.RELEASE | 5.3.8.RELEASE |
2.3.8.RELEASE | 5.3.6.RELEASE |
2.3.7.RELEASE | 5.3.6.RELEASE |
2.3.6.RELEASE | 5.3.5.RELEASE |
2.3.5.RELEASE | 5.3.5.RELEASE |
2.3.4.RELEASE | 5.3.4.RELEASE |
2.3.3.RELEASE | 5.3.4.RELEASE |
2.3.2.RELEASE | 5.3.3.RELEASE |
2.3.1.RELEASE | 5.3.3.RELEASE |
2.3.0.RELEASE | 5.3.2.RELEASE |
2.2.13.RELEASE | 5.2.8.RELEASE |
2.2.12.RELEASE | 5.2.8.RELEASE |
2.2.11.RELEASE | 5.2.7.RELEASE |
2.2.10.RELEASE | 5.2.6.RELEASE |
2.2.9.RELEASE | 5.2.5.RELEASE |
2.2.8.RELEASE | 5.2.5.RELEASE |
2.2.7.RELEASE | 5.2.4.RELEASE |
2.2.6.RELEASE | 5.2.2.RELEASE |
2.2.5.RELEASE | 5.2.2.RELEASE |
2.2.4.RELEASE | 5.2.1.RELEASE |
2.2.3.RELEASE | 5.2.1.RELEASE |
2.2.2.RELEASE | 5.2.1.RELEASE |
2.2.1.RELEASE | 5.2.1.RELEASE |
2.2.0.RELEASE | 5.2.0.RELEASE |
2.1.18.RELEASE | 5.1.13.RELEASE |
2.1.17.RELEASE | 5.1.12.RELEASE |
2.1.16.RELEASE | 5.1.11.RELEASE |
2.1.15.RELEASE | 5.1.11.RELEASE |
2.1.14.RELEASE | 5.1.10.RELEASE |
2.1.13.RELEASE | 5.1.8.RELEASE |
2.1.12.RELEASE | 5.1.7.RELEASE |
2.1.11.RELEASE | 5.1.7.RELEASE |
2.1.10.RELEASE | 5.1.7.RELEASE |
2.1.9.RELEASE | 5.1.6.RELEASE |
2.1.8.RELEASE | 5.1.6.RELEASE |
2.1.7.RELEASE | 5.1.6.RELEASE |
2.1.6.RELEASE | 5.1.5.RELEASE |
2.1.5.RELEASE | 5.1.5.RELEASE |
2.1.4.RELEASE | 5.1.5.RELEASE |
2.1.3.RELEASE | 5.1.4.RELEASE |
2.1.2.RELEASE | 5.1.3.RELEASE |
2.1.1.RELEASE | 5.1.2.RELEASE |
2.1.0.RELEASE | 5.1.1.RELEASE |
2.0.9.RELEASE | 5.0.12.RELEASE |
2.0.8.RELEASE | 5.0.11.RELEASE |
2.0.7.RELEASE | 5.0.10.RELEASE |
2.0.6.RELEASE | 5.0.9.RELEASE |
2.0.5.RELEASE | 5.0.8.RELEASE |
2.0.4.RELEASE | 5.0.7.RELEASE |
2.0.3.RELEASE | 5.0.6.RELEASE |
2.0.2.RELEASE | 5.0.5.RELEASE |
2.0.1.RELEASE | 5.0.4.RELEASE |
2.0.0.RELEASE | 5.0.3.RELEASE |
1.5.22.RELEASE | 4.2.13.RELEASE |
1.5.21.RELEASE | 4.2.12.RELEASE |
1.5.20.RELEASE | 4.2.12.RELEASE |
1.5.19.RELEASE | 4.2.11.RELEASE |
1.5.18.RELEASE | 4.2.10.RELEASE |
1.5.17.RELEASE | 4.2.9.RELEASE |
1.5.16.RELEASE | 4.2.8.RELEASE |
1.5.15.RELEASE | 4.2.7.RELEASE |
1.5.14.RELEASE | 4.2.7.RELEASE |
1.5.13.RELEASE | 4.2.6.RELEASE |
1.5.12.RELEASE | 4.2.5.RELEASE |
1.5.11.RELEASE | 4.2.5.RELEASE |
1.5.10.RELEASE | 4.2.4.RELEASE |
1.5.9.RELEASE | 4.2.3.RELEASE |
1.5.8.RELEASE | 4.2.3.RELEASE |
1.5.7.RELEASE | 4.2.3.RELEASE |
1.5.6.RELEASE | 4.2.3.RELEASE |
1.5.5.RELEASE | 4.2.3.RELEASE |
1.5.4.RELEASE | 4.2.3.RELEASE |
1.5.3.RELEASE | 4.2.2.RELEASE |
1.5.2.RELEASE | 4.2.2.RELEASE |
1.5.1.RELEASE | 4.2.1.RELEASE |
1.5.0.RELEASE | 4.2.1.RELEASE |
1.4.7.RELEASE | 4.1.4.RELEASE |
1.4.6.RELEASE | 4.1.4.RELEASE |
1.4.5.RELEASE | 4.1.4.RELEASE |
1.4.4.RELEASE | 4.1.4.RELEASE |
1.4.3.RELEASE | 4.1.4.RELEASE |
1.4.2.RELEASE | 4.1.3.RELEASE |
1.4.1.RELEASE | 4.1.3.RELEASE |
1.4.0.RELEASE | 4.1.1.RELEASE |
1.3.8.RELEASE | 4.0.4.RELEASE |
1.3.7.RELEASE | 4.0.4.RELEASE |