11-InMemoryUserDetailsService的创建
实现步骤:
1、新建maven项目
2、加入gav依赖坐标
(1)springboot
(2)spring-boot-security-starter
(3)spring-boot-web-starter
<!--security-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<!--web-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
3、创建应用的配置类
(1)创建密码的处理类对象
(2)使用InMemoryUserDetailsService创建用户
4、创建类继承WebSecurityConfigurerAdapter
自定义安全配置
5、测试

浙公网安备 33010602011771号