1.SpringSecurity介绍
Spring Security是一个能够为基于Spring的企业应用系统提供声明式的安全访问控制解决方案的安全框架。它提供了一组可以在Spring应用上下文中配置的Bean,充分利用了Spring IOC,DI(控制反转 Inversion of Control, DI:Dependency Injection依赖注入) 和 AOP(面向切面编程)功能,为应用系统提供声明式的安全访问控制功能,减少了为企业系统安全控制编写大量重复代码的工作。
2.SpringSecurity入门
1.搭建工程
基于 SpringBoot 搭建Web工程,项目名为"spring-security-demo"。
2.导入依赖
这里继承了SpringBoot的父工程,引入了SpringSecurity 基础依赖:
"spring-boot-starter-security",以及集成Web的依赖"spring-boot-starter-web"
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.5.RELEASE</version>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<ma