Cannot get connection for redisTemplate for Spring data redis

后端 未结 10 2024
太阳男子
太阳男子 2020-12-05 21:25

I\'m trying to publish a message to a channel using Spring data Redis using Jedis. Here is a very simple Java config:

@Bean(name=\"jedisConnectionFactory\")
         


        
10条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-05 21:53

    Navin Viswanath, thank you for the solution! How did you find it, using docs or debugging?

    For those who use Gradle, here is my combination:

    Versions:

    • Redis 3.0.2
    • Jedis 2.7.2
    • Spring Data Redis 1.6.0 M1 (not available in maven central, because it's milestone release - add http://repo.spring.io/milestone/ repo)

    build.gradle:

    repositories {
      mavenCentral()
      maven { url 'http://repo.spring.io/release/' }
      maven { url 'http://repo.spring.io/milestone/' }
    }
    
    dependencies {
      compile group: 'redis.clients', name: 'jedis', version: '2.7.2'
      compile group: 'org.springframework.data', name: 'spring-data-redis', version: '1.6.0.M1'
    }
    

    Please note that Spring Data Redis 1.6.0.M1 will be removed once it becomes release, you need to change it to 1.6.0.RELEASE when it is available as release.

    So, I checked for version compatibility here: https://github.com/spring-projects/spring-data-redis/blob/master/gradle.properties and found related JIRA ticket here: https://jira.spring.io/browse/DATAREDIS-396

提交回复
热议问题