1.声明
当前内容用于本人学历SpringSession这个Session管理工具,主要使用Redis实现
个人实现分析可行性
- 一般应用中我们直接与当前的Redis交互,添加指定的数据(作为数据共享的地方)
- SpringSessionRedis,一看就是往Redis存放Session数据的地方
- 怎么将HttpSession中存放的数据改为存放在Redis中?
3.1 可以自己实现HandlerMethodArgumentResolver用于处理何解析HttpSession的实现类
3.2 我们可以创建自己的HttpSession,并实现数据的存放使用Redis方式
3.3 总之,替换HttpSession并重写其操作即可
2.pom依赖
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.5.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session-data-redis</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-data-redis -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org