博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
spring-session使用配置(分布式共享session配置)
阅读量:2394 次
发布时间:2019-05-10

本文共 937 字,大约阅读时间需要 3 分钟。

1. 添加依赖

  

org.springframework.session
spring-session-data-redis
1.2.0.RELEASE

2. spring-mvc.xml配置文件添加:

3. web.xml添加

contextConfigLocation
classpath:spring-mvc.xml
springSessionRepositoryFilter
org.springframework.web.filter.DelegatingFilterProxy
springSessionRepositoryFilter
/*

 

这样就可以实现分布式Session了。

注意:1.spring的这个配置文件一定要写在web.xml的<context-param>部分,写在其他地方不行。

     2.filter的名字必须是springSessionRepositoryFilter

     3.如果使用了shiro,web.xml中一定要把<context-param>放在最前面,然后写shiro的Filter配置,再写spring-session的Filter配置。后面就是其他的编码和servlet配置了。

redis搭建:  按照此方法有jar依赖冲突  按照评论的去掉那个依赖即可

web.xml配置报错:

文档地址:

转载地址:http://rrwob.baihongyu.com/

你可能感兴趣的文章
compressed/head.s __setup_mmu
查看>>
__proc_info_begin->__proc_info_end
查看>>
__lookup_processor_type
查看>>
指令+s对cpsr中标志位的影响
查看>>
ARM中MMU地址转换理解
查看>>
GUN ARM汇编中标号的引用在汇编和C语言中区别
查看>>
__vet_atags
查看>>
ARM指令后缀与常用读取指令
查看>>
__create_page_tables
查看>>
__v7_setup
查看>>
__enable_mmu
查看>>
__get_cpu_architecture
查看>>
cat /proc/cpuinfo
查看>>
seq_file文件的内核读取过程
查看>>
Linux __setup解析
查看>>
设计模式--模板方法(Template Method)
查看>>
Java--String常用API
查看>>
设计模式--代理模式(Proxy Pattern)
查看>>
Java--大数值(BigInteger 和 BigDecimal)
查看>>
Spring框架基础配置
查看>>