Setting up Spring Security

To install Spring Security, let's add the following dependency to pom.xml:

<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>

We add spring-security-test so that we can use it in the unit test to make sure the endpoints of our application have permission configured correctly. In order to see what Spring Security does, let's turn on the debug-level logging by adding the following configuration to src/main/resources/application.properties:

logging.level.org.springframework.security=DEBUG

Now, let's add ...

Get Building Applications with Spring 5 and Vue.js 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.