How to use Spring cache Manager with redis 1.6.2.RELEASE

We are using Spring Cache Manager with spring-data-redis 1.5.2. These days we want to upgrade spring-data-redis to latest release i.e:1.6.2.RELEASE.

For some weird reason everything works good with 1.5.2 but when upgrading to 1.6.2 we get

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'cacheManager' defined in ServletContext resource [/WEB-INF/spring-cache.xml]: Unsatisfied dependency expressed through constructor argument with index 0 of type []: Ambiguous constructor argument types - did you specify the correct bean references as constructor arguments?

This message seems like a mistake as redisTemplate is RedisTemplate which implements RedisOperations.

Any idea how to solve it?


note that when removing the cache configuration the 1.6.2 version seems to work good. So the issue is with the cache.

<context:annotation-config />
    <bean class="" />

        class="" />

    <!-- end of seesion managment configuration -->

    <bean id="redisConnectionFactory"
        <property name="port" value="${app.redis.port}" />
        <property name="hostName" value="${app.redis.hostname}" />
        <property name="password" value="${app.redis.password}" />
        <property name="usePool" value="true" />

    <!-- for publishing string over redis channels -->
    <bean id="stringRedisTemplate" class="">
        <property name="connectionFactory" ref="redisConnectionFactory" />

    <!-- for storing object into redis key,value -->
    <bean id="redisTemplate" class="">
        <property name="connectionFactory" ref="redisConnectionFactory" />
<!-- This file must load after spring-redis.xml -->
 <cache:annotation-driven /> 

<!-- declare Redis Cache Manager -->
<bean id="cacheManager" class=""
    c:template-ref="redisTemplate" />

It seems the reason for this bug is that RedisCacheManager has two constructors. Both of them has RedisOperations as parameter. Forsome reason Spring couldnot understand its related to the first constructor and not to the second one. a work around is mention constructor-arg index

<bean id="cacheManager" class="">
        <constructor-arg index="0" ref="redisTemplate"></constructor-arg>

Spring Data Redis, version 1.6.2. Performance improvements in RedisCache now releasing it easy to write Spring applications that use the Redis key value store by eliminating declare Redis Cache Manager --> <bean id="cacheManager"� Spring Redis Cache Service We leverage spring’s @Cacheable annotation to add caching capabilities to the play() method. We can provide a condition to the annotation.

While upgrading from Spring Data Redis 1.5.2.RELEASE to 1.6.2.RELEASE, we need to use the below config for RedisCacheManager. Previous releases were using redis-template-ref instead of redis-operations-ref.

<beans:bean id='cacheManager'

Changelog, DATAREDIS-611 - Improve Template API by using Java 8 types. * DATAREDIS- 538 DATAREDIS-935 - Cache manager builder can lead to inconsistent state. * DATAREDIS-932 DATAREDIS-441 - Release 1.6.2 (Gosling). Changes in� We are using Spring Cache Manager with spring-data-redis 1.5.2.These days we want to upgrade spring-data-redis to latest release i.e:1.6.2.RELEASE.. For some weird reason everything works good with 1.5.2 but when upgrading to 1.6.2 we get

This is an old question, but for those who reach this page.

<bean id="cacheManager" class="" factory-method="create" c:connection-factory-ref="jedisConnectionFactory" p:transaction-aware="true" />

<bean id="redisTemplate" class="" p:connection-factory-ref="jedisConnectionFactory" />

<bean id="jedisConnectionFactory" class="" p:host-name="${}" p:port="${cache.redis.port}" p:use-pool="true">
  <constructor-arg ref="jedisPoolConfig"></constructor-arg>

<bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig" p:maxTotal="${cache.redis.pool.maxTotal}" p:maxIdle="${cache.redis.pool.maxIdle}" p:maxWaitMillis="${cache.redis.pool.maxWaitMillis}" p:testOnBorrow="true" />

Spring Data Redis, Support for Geospatial Indexes using Spring Data Repository abstractions (see Geospatial Performance improvements in RedisCache , now releasing connections earlier. declare Redis Cache Manager --> <bean id=" cacheManager"� Adding the Redis and Cache dependency to our new project here will add the spring-boot-starter-data-redis and spring-boot-starter-cache as dependencies to our service. We just created a Spring Boot Service using Redis as a Cache. 1.2 Open up IntelliJ IDEA If you are using IntelliJ IDEA, you also can just use the initializer from within IDEA itself. Maven , Group: ➦ Artifact: spring-data-redis ➦ Version: 1.6.2 .RELEASE. CacheManager; import org.springframework.cache.transaction. RedisCacheManager} will try to retrieve cache names from redis server using� The good news is that you can perform caching with Spring and Redis by using a third-party Redis Java client, such as Redisson. Redisson is fully compatible with the Spring framework. Redisson is

Как использовать Spring cache Manager с redis 1.6.2.RELEASE , Мы используем Spring Cache Manager с spring-data-redis 1.5.2 . В настоящее время мы хотим обновить spring-data-redis до последней версии i.e: 1.6.2. Redis Server and Redis Desktop Manager; Spring Boot Based Rest Service. As part of this post, we will build a simple spring-boot based rest service. This rest service will provide data related to companies which will be stored in mysql database. We will be using Gradle to build our dependencies in this project.

spring-data-redis Spring integrates redis for cache xml implementation, xml implementation. tags: redis cache Spring integrates redis redisTemplate serialization <version>1.6.2.RELEASE</version> Use @Cacheable, @ CachePut, @CacheEvict, @CacheConfig spring to cache methods through AOP. * <p>. If you're a Spring Boot user, then use the spring-boot-starter-cache starter package to easily add the caching dependencies: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-cache</artifactId> </dependency> Under the hood, the starter brings the spring-context-support module. 3. Enable Caching

  • Thank you so much .. Very useful :)