Why is data getting stored with weird keys in Redis when using Jedis with Spring Data?

Ok, googled around for a while and found help at http://java.dzone.com/articles/spring-data-redis. It happened because of Java serialization. The key serializer for redisTemplate needs to be configured to StringRedisSerializer i.e. like this: <bean id=”jedisConnectionFactory” class=”org.springframework.data.redis.connection.jedis.JedisConnectionFactory” p:host-name=”${redis.server}” p:port=”${redis.port}” p:use-pool=”true”/> <bean id=”stringRedisSerializer” class=”org.springframework.data.redis.serializer.StringRedisSerializer”/> <bean id=”redisTemplate” class=”org.springframework.data.redis.core.RedisTemplate” p:connection-factory-ref=”jedisConnectionFactory” p:keySerializer-ref=”stringRedisSerializer” p:hashKeySerializer-ref=”stringRedisSerializer” /> Now the key in redis is vc:501381. Or … Read more