使用spring-session同时用session范围bean的问题

指定bean的范围是session
@Scope(value = WebApplicationContext.SCOPE_SESSION,
        proxyMode= ScopedProxyMode.INTERFACES)
<bean id="redisTemplate" class="org.springframework.data.redis.core.RedisTemplate">
        <property name="connectionFactory"   ref="lettuceConnectionFactory" />
        <property name="keySerializer" >
            <bean class="org.springframework.data.redis.serializer.StringRedisSerializer"/>
        </property>
        <property name="valueSerializer" >
            <bean class="org.springframework.data.redis.serializer.JdkSerializationRedisSerializer"/>
        </property>
    </bean>

在使用外部session存储的时候并且使用默认的jdk序列化的方式的话,会话范围内的bean所有依赖的bean及其自身都必须是可序列化的,因为该bean及其依赖的bean都会被序列化后保存到外部存储上

这里写图片描述

posted @ 2017-01-09 11:16  A_yes  阅读(145)  评论(0编辑  收藏  举报