1、pom添加jar依赖
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-redis</artifactId> </dependency> <dependency> <groupId>org.springframework.session</groupId> <artifactId>spring-session-data-redis</artifactId> </dependency>
2、开启session共享功能
@EnableRedisHttpSession
3、配置添加
spring.redis.host=localhost
spring.redis.port=6379
4、spring boot + redis实现session共享完成
request.getSession().setAttribute("request Url", request.getRequestURL());
request.getSession().getAttribute("request Url");