Spring Boot provides support for setting up Spring Security through a corresponding starter and auto-configuration:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
See also the Securing a Web Application Guide or the Spring Boot Security Documentation for more information, e.g., how to set up OAuth2.