使用spring session redis实现共享session之后,httpsession监听失效

原因是配置了:
<util:constant static-field="org.springframework.session.data.redis.config.ConfigureRedisAction.NO_OP"/>
   这一行。

参考官网文章:
https://docs.spring.io/spring-session/docs/1.1.0.M1/reference/html5/#httpsession-httpsessionlistener

看到这样的一段:
引用
If you are using @EnableRedisHttpSession the SessionMessageListener and enabling the necessary Redis Keyspace events is done automatically. However, in a secured Redis enviornment the config command is disabled. This means that Spring Session cannot configure Redis Keyspace events for you. To disable the automatic configuration add ConfigureRedisAction.NO_OP as a bean.


解决办法:
去掉配置:
<util:constant static-field="org.springframework.session.data.redis.config.ConfigureRedisAction.NO_OP"/>

如果还不行,那就需要开启redis的key失效事件监听。
参考文章:http://blog.csdn.net/aeroleo/article/details/77011839

猜你喜欢

转载自fp-forever.iteye.com/blog/2412043