SpringBoot redis Session 域配置
来源:互联网 发布:乐贝网络校园招聘 编辑:程序博客网 时间:2024/06/05 16:50
在springboot中使用spring-session的时候,在不同的子域名下面需要配置cookie主域否则session共享不生效
@EnableRedisHttpSessionpublic class SessionConfig { @Bean public CookieSerializer cookieSerializer() { DefaultCookieSerializer defaultCookieSerializer = new DefaultCookieSerializer(); //cookie名字 defaultCookieSerializer.setCookieName("sessionId"); //域 defaultCookieSerializer.setDomainName("xxx.com"); //存储路径 defaultCookieSerializer.setCookiePath("/"); } return defaultCookieSerializer; }}
在启动类中Import(SessionConfig.class)
附上xml配置
<bean class="org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration"> <property name="cookieSerializer" ref="cookieSerializer" /></bean><bean id="cookieSerializer" class="org.springframework.session.web.http.DefaultCookieSerializer"> <property name="cookiePath" value="/" /> <property name="domainName" value="xxx.com" /> <property name="cookieName" value="sessionId" /></bean>
0 0
- SpringBoot redis Session 域配置
- springboot整合redis,实现session共享
- springboot(七)redis 实现session共享
- vue+axios+springboot+redis 实现session 共享
- 使用springboot+redis实现session共享
- springboot + redis集群实现session共享
- 五、SpringBoot JPA 配置redis
- springboot之redis的配置
- Redis在SpringBoot中的配置
- springboot配置Redis主从服务
- Springboot+Redis 配置和使用
- SpringBoot配置Redis连接池
- django-redis-session配置
- spring session redis 配置
- php session redis 配置
- Session一致性配置---Redis
- spring-session使用配置redis
- redis集群共享session配置
- H3 BPM MVC表单SheetAttachment控件使用
- 完美解决Authentication denied: Boot identity not valid
- Android 组件化案例
- 笔记本电脑的硬件介绍和一些常见问题的解决
- hive 底层模块实现-distinct
- SpringBoot redis Session 域配置
- Python用WMI模块获取Windows系统的硬件信息
- Spring Boot 4--连接oracle数据库案例
- SpringMvc中@RequestMapping详解
- Eclipse无法启动报An internal error occurred during: "reload maven project". java.lang.NullPointerExceptio
- github
- Eclipse优化设置技巧
- AJDK 8.0.0 Release Notes
- GridView的使用