This section describes how to get the Spring Security binaries. See Source Code for how to obtain the source code.
本节介绍如何获取 Spring Security 二进制文件。有关如何获取源代码,请参阅源代码。
Release Numbering 版本编号
Spring Security versions are formatted as MAJOR.MINOR.PATCH such that:
-
MAJOR (主要) versions may contain breaking changes. Typically, these are done to provide improved security to match modern security practices.
-
MINOR (次要) versions contain enhancements but are considered passive updates.
-
PATCH (补丁) level should be perfectly compatible, forwards and backwards, with the possible exception of changes that fix bugs.
Usage with Maven
As most open source projects, Spring Security deploys its dependencies as Maven artifacts. The topics in this section describe how to consume Spring Security when using Maven.
与大多数开源项目一样,Spring Security 将其依赖项部署为 Maven 工件。本节中的主题介绍如何在使用 Maven 时使用 Spring Security。
Spring Boot with Maven
Spring Boot provides a spring-boot-starter-security
starter that aggregates Spring Security-related dependencies. The simplest and preferred way to use the starter is to use Spring Initializr by using an IDE integration in (Eclipse or IntelliJ, NetBeans) or through start.spring.io. Alternatively, you can manually add the starter, as the following example shows:
Spring Boot 提供了一个 spring-boot-starter-security 启动器,用于聚合与 Spring Security 相关的依赖项。使用启动器的最简单和首选方法是通过使用 IDE 集成(Eclipse 或 IntelliJ、NetBeans)或通过 start.spring.io 来使用 Spring Initializr。或者,您可以手动添加启动器,如以下示例所示:
pom.xml
<properties> <spring-security.version>6.2.4</spring-security.version> </properties> <dependencies> <!-- ... other dependency elements ... --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency> </dependencies>
Since Spring Boot provides a Maven BOM to manage dependency versions, you do not need to specify a version. If you wish to override the Spring Security version, you can do so by providing a Maven property:
由于 Spring Boot 提供了 Maven BOM 来管理依赖版本,因此无需指定版本。如果要覆盖 Spring Security 版本,可以通过提供 Maven 属性来实现:
pom.xml
<properties> <!-- ... --> <spring-security.version>6.3.1</spring-security.version> </properties>
If you use additional features (such as LDAP, OAuth 2, and others), you need to also include the appropriate Project Modules and Dependencies.
如果使用其他功能(如 LDAP、OAuth 2 等),则还需要包含相应的项目模块和依赖项。
Maven Repositories
All GA releases (that is, versions ending in .RELEASE) are deployed to Maven Central, so you need not declare additional Maven repositories in your pom.
所有 GA 版本(即以 . 结尾的版本)RELEASE) 部署到 Maven Central,因此您无需在 pom 中声明其他 Maven 存储库。
If you use a SNAPSHOT version, you need to ensure that you have the Spring Snapshot repository defined:
如果使用 SNAPSHOT 版本,则需要确保定义了 Spring Snapshot 存储库:
pom.xml
<repositories> <!-- ... possibly other repository elements ... --> <repository> <id>spring-snapshot</id> <name>Spring Snapshot Repository</name> <url>https://repo.spring.io/snapshot</url> </repository> </repositories>
If you use a milestone or release candidate version, you need to ensure that you have the Spring Milestone repository defined, as the following example shows:
如果使用里程碑或候选发布版本,则需要确保定义了 Spring Milestone 存储库,如以下示例所示:
pom.xml
<repositories> <!-- ... possibly other repository elements ... --> <repository> <id>spring-milestone</id> <name>Spring Milestone Repository</name> <url>https://repo.spring.io/milestone</url> </repository> </repositories>
标签:Getting,Spring,Maven,pom,spring,Security,starter From: https://www.cnblogs.com/neverheartache/p/18311217