You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/modules/ROOT/pages/getting-spring-security.adoc
+17-9Lines changed: 17 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,5 @@
1
1
[[getting]]
2
+
[[getting-gradle]]
2
3
= Getting Spring Security
3
4
4
5
This section describes how to get the Spring Security binaries.
@@ -15,13 +16,13 @@ Typically, these are done to provide improved security to match modern security
15
16
16
17
17
18
[[maven]]
18
-
== Usage with Maven and Gradle
19
+
== Usage
19
20
20
21
As most open source projects, Spring Security deploys its dependencies as Maven artifacts, which makes them compatible with both Maven and Gradle. The following sections demonstrate how to integrate Spring Security with these build tools, with examples for Spring Boot and standalone usage.
21
22
22
23
[[getting-maven-boot]]
23
24
[[getting-gradle-boot]]
24
-
=== Spring Boot with Maven and Gradle
25
+
=== Spring Boot
25
26
26
27
Spring Boot provides a `spring-boot-starter-security` starter that aggregates Spring Security-related dependencies.
27
28
The simplest and preferred way to use the starter is to use https://docs.spring.io/initializr/docs/current/reference/html/[Spring Initializr] by using an IDE integration in (https://joshlong.com/jl/blogPost/tech_tip_geting_started_with_spring_boot.html[Eclipse] or https://www.jetbrains.com/help/idea/spring-boot.html#d1489567e2[IntelliJ], https://github.com/AlexFalappa/nb-springboot/wiki/Quick-Tour[NetBeans]) or through https://start.spring.io.
@@ -56,7 +57,7 @@ dependencies {
56
57
======
57
58
58
59
Since Spring Boot provides a Maven BOM to manage dependency versions, you do not need to specify a version.
59
-
If you wish to override the Spring Security version, you can do so by providing a Maven property or declaring it as a Gradle property, as shown below:
60
+
If you wish to override the Spring Security version, you can do so with a build property as shown below:
Since Spring Security makes breaking changes only in major releases, you can safely use a newer version of Spring Security with Spring Boot.
85
86
However, at times, you may need to update the version of Spring Framework as well.
86
-
You can do so by adding a Maven or Gradle property:
87
+
You can do so by adding a build property like so:
87
88
88
89
[tabs]
89
90
======
@@ -113,7 +114,7 @@ If you use additional features (such as LDAP, OAuth 2, and others), you need to
113
114
[[getting-maven-no-boot]]
114
115
=== Standalone Usage (Without Spring Boot)
115
116
116
-
When you use Spring Security without Spring Boot, the preferred way is to use Spring Security's BOM to ensure that a consistent version of Spring Security is used throughout the entire project. For Gradle, you can do so by using the https://github.com/spring-gradle-plugins/dependency-management-plugin[Dependency Management Plugin]:
117
+
When you use Spring Security without Spring Boot, the preferred way is to use Spring Security's BOM to ensure that a consistent version of Spring Security is used throughout the entire project.
117
118
118
119
[tabs]
119
120
======
@@ -154,6 +155,8 @@ dependencyManagement {
154
155
----
155
156
======
156
157
158
+
[TIP]
159
+
Spring provides a https://github.com/spring-gradle-plugins/dependency-management-plugin[`Dependency Management Plugin`] for Gradle
157
160
158
161
A minimal Spring Security Maven set of dependencies typically looks like the following example:
159
162
@@ -194,7 +197,7 @@ If you use additional features (such as LDAP, OAuth 2, and others), you need to
194
197
195
198
Spring Security builds against Spring Framework {spring-core-version} but should generally work with any newer version of Spring Framework 5.x.
196
199
Many users are likely to run afoul of the fact that Spring Security's transitive dependencies resolve Spring Framework {spring-core-version}, which can cause strange classpath problems.
197
-
The easiest way to resolve this is to use the `spring-framework-bom` within the `<dependencyManagement>` section of your `pom.xml` or your `dependencyManagement` section of your `build.gradle`. For Gradle, you can do so by using the https://github.com/spring-gradle-plugins/dependency-management-plugin[Dependency Management Plugin]:
200
+
The easiest way to resolve this is to use the `spring-framework-bom` within the `<dependencyManagement>` section of your `pom.xml` or your `dependencyManagement` section of your `build.gradle`.
198
201
199
202
[tabs]
200
203
======
@@ -235,6 +238,9 @@ dependencyManagement {
235
238
----
236
239
======
237
240
241
+
[TIP]
242
+
Spring provides a https://github.com/spring-gradle-plugins/dependency-management-plugin[`Dependency Management Plugin`] for Gradle
243
+
238
244
The preceding example ensures that all the transitive dependencies of Spring Security use the Spring {spring-core-version} modules.
239
245
240
246
[NOTE]
@@ -243,9 +249,11 @@ This approach uses Maven's "`bill of materials`" (BOM) concept and is only avail
243
249
For additional details about how dependencies are resolved, see https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html[Maven's Introduction to the Dependency Mechanism documentation].
244
250
====
245
251
246
-
[[maven-gradle-gearepositories]]
247
-
=== Maven and Gradle Repositories
248
-
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.xml` or, for Gradle, using the `mavenCentral()` repository is sufficient for GA releases.
252
+
[[maven-gearepositories]]
253
+
=== Maven Repositories
254
+
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.xml`.
255
+
256
+
For Gradle using the `mavenCentral()` repository is sufficient for GA releases.
0 commit comments