需要在配置文件如下配置中添加红色部分,配置前请先检查shiro版本是否支持
1 <!-- 会话管理器 --> 2 3 <bean id="sessionManager" class="org.apache.shiro.web.session.mgt.DefaultWebSessionManager"> 4 5 <property name="sessionIdUrlRewritingEnabled" value="false" /> 6 7 <!-- 验证会话时会话的过期时间(毫秒) --> 8 9 <property name="globalSessionTimeout" value="3600000" /> 10 11 <property name="sessionFactory" ref="sessionFactory" /> 12 13 <property name="sessionValidationScheduler" ref="redisValidationScheduler" /> 14 15 <property name="sessionDAO" ref="sessionDAO" /> 16 17 <property name="sessionIdCookie" ref="sessionIdCookie" /> 18 19 <property name="sessionListeners"> 20 21 <list> 23 <ref bean="redisSessionListener" /> 25 </list> 27 </property> 29 </bean>