spring 的 RedisTemplate解決Serializer

找了半天, 原來在這能夠配置它的序列化方式redis

valueSerializer 對應opsForValuespring

hashValueSerializer 對應 HashOperationsspa


JDK的以下hash


<bean id="creditRedisTemplate" class="org.springframework.data.redis.core.StringRedisTemplate">it

<property name="connectionFactory" ref="jedisConnectionFactory" />io

<property name="valueSerializer">class

<bean配置

class="org.springframework.data.redis.serializer.JdkSerializationRedisSerializer" />序列化

</property>di

<property name="hashValueSerializer">

<bean

class="org.springframework.data.redis.serializer.JdkSerializationRedisSerializer" />

</property>

</bean>

相關文章
相關標籤/搜索