title: Spring Data RedisTemplate: Serializing the Value and HashValue
body: <p>I tried following this tutorial:
  <a href="http://javakart.blogspot.in/2012/12/spring-data-redis-hello-world-example.html" rel="nofollow noreferrer">http://javakart.blogspot.in/2012/12/spring-data-redis-hello-world-example.html</a></p>
  
  <p>My question is related to this:
  <a href="https://stackoverflow.com/questions/13215024/weird-redis-key-with-spring-data-jedis">Weird redis key with spring data Jedis</a></p>
  
  <p>I was able to solve the keys and hashkeys using the StringRedisSerializer .</p>
  
  <pre><code>&lt;bean 
  id="stringRedisSerializer" 
  class="org.springframework.data.redis.serializer.StringRedisSerializer"/&gt;
  
  &lt;bean 
  id="redisTemplate" 
  class="org.springframework.data.redis.core.RedisTemplate"
  p:connection-factory-ref="jedisConnectionFactory" 
  p:keySerializer-ref="stringRedisSerializer"
  p:hashKeySerializer-ref="stringRedisSerializer" 
  /&gt;
  </code></pre>
  
  <p>However I found it a problem using a serializer for the value and hashvalue.</p>
  
  <p>I tried adding this:</p>
  
  <pre><code>p:valueSerializer-ref="stringRedisSerializer"
  p:hashValueSerializer-ref="stringRedisSerializer"
  </code></pre>
  
  <p>But an error prompted:
  "User cannot be cast to java.lang.String"</p>
  
  <p>Can anyone share how to use a serializer for the value/hashvalue?</p>