Getting Started

Learn how to add Spring Security to a project.

We can use Spring Boot’s most straightforward approach to get things off the ground. Here, we’ll add Spring Security to the project.

Adding Spring Security

Let’s add Spring Security as follows and see what Spring Boot does for us:

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
pom.xml

In addition to adding Spring Security to our project, this also includes spring-security-test in a test-scoped fashion. This makes it super easy to write some security-oriented test cases further down in ...