title: storing raw json in redis by using spring-data-redis
body: <p>I am using RedisCacheManager to store my cache data in my spring-boot application. Default serializer seems to serialize everything into byte and deserialize from byte to appropriate java type. </p>
  
  <p>However, I want to make the cache data be stored as json so that I can read it from none-java clients.</p>
  
  <p>I found that switching from default one to other serializers such as Jackson2JsonRedisSerializer supposed to work. After doing this, deserialization phase fails.</p>
  
  <p>pom.xml</p>
  
  <pre><code>    &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.data&lt;/groupId&gt;
          &lt;artifactId&gt;spring-data-redis&lt;/artifactId&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;redis.clients&lt;/groupId&gt;
          &lt;artifactId&gt;jedis&lt;/artifactId&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p>CacheConfig.java</p>
  
  <pre><code>@Configuration
  @EnableCaching
  public class CacheConfig {
  
      @Bean
      public RedisConnectionFactory createRedisConnectionFactory() {
          JedisConnectionFactory factory = new JedisConnectionFactory();
          factory.setHostName("localhost");
          return factory;
      }
  
  //    SPRING-DATA-REDIS ALREADY PROVIDES A STRING REDIS TEMPLATE, SO THE FOLLOWING IS NOT NECESSARY
  //    @Bean
  //    public RedisTemplate&lt;String, String&gt; createRedisTemplate(RedisConnectionFactory factory) {
  //        RedisTemplate&lt;String, String&gt; redisTemplate = new RedisTemplate&lt;&gt;();
  //        redisTemplate.setConnectionFactory(factory);
  //        return redisTemplate;
  //    }
  
      @Bean
      public CacheManager redisCacheManager(RedisTemplate redisTemplate) {
          RedisCacheManager cacheManager = new RedisCacheManager(redisTemplate);
          return cacheManager;
      }
  }
  </code></pre>
  
  <p>Is there a way to store them in a pure JSON format and successfully deserialize from it?</p>