title: How to use Spring Cache Redis with a custom RestTemplate?
body: <p>I'm migrating my Spring application from Spring-boot 1.5.9 to Spring-boot 2.0.0.
  With this new Spring bundle, I have some issues with caching data in Redis.</p>
  
  <p>In my Configuration, I have 3 CacheManager with differents TTL (long, medium and short) :</p>
  
  <pre><code>@Bean(name = "longLifeCacheManager")
  public CacheManager longLifeCacheManager() {
      RedisCacheConfiguration cacheConfiguration =
              RedisCacheConfiguration.defaultCacheConfig()
                      .entryTtl(Duration.ofSeconds(redisExpirationLong))
                      .disableCachingNullValues();
      return RedisCacheManager.builder(jedisConnectionFactory()).cacheDefaults(cacheConfiguration).build();
  }
  </code></pre>
  
  <p>I also have a custom RestTemplate :</p>
  
  <pre><code>@Bean
  public RedisTemplate&lt;?, ?&gt; redisTemplate(RedisConnectionFactory connectionFactory) {
      RedisTemplate&lt;?, ?&gt; template = new RedisTemplate&lt;&gt;();
      template.setDefaultSerializer(new GenericJackson2JsonRedisSerializer());
      template.setConnectionFactory(connectionFactory);
      return template;
  }
  </code></pre>
  
  <p>With the previous Spring version, every data that is cached use this RestTemplate and was serialized with the GenericJackson2JsonRedisSerializer.</p>
  
  <p>With the new Spring version, the CacheManager don't use the RestTemplate but use its own SerializationPair. This result to everything beeing serialized with the default JdkSerializationRedisSerializer.</p>
  
  <p>Is it possible to configure the CacheManager to use the RestTemplate and how ?
  If it is not possible, what can I do to use the JacksonSerializer instead of the JdkSerializer ?</p>