Cannot get connection for redisTemplate for Spring data redis

后端 未结 10 2027
太阳男子
太阳男子 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:52

    For those using Spring-boot-starter-data-redis

    A permanent fix can be entered as follows:

    1. Determine the version of spring-boot-starter-data-redis. In eclipse, you can mouse over the dependency entry in your pom.xml file. It will tell you the version you are using.
    2. Navigate to that version directory in your maven repository.
    3. Edit the pom file and add the version number of redis client that is needed. In this case version 2.6.2.RELEASE to go with version 1.50 of spring-boot-starter-data-redis. In this case I had to add 2.6.2.RELEASE.
    4. In your IDE, refresh your entire project. To do this in eclipse or STS, click once on the project name->right click select maven->Update Project
    5. Check your maven dependencies list and the jedis version should now be 2.6.2.
    6. Compile your project.
    7. Open the .war archive with jar or 7-zip etc. Find the lib directory under WEB-INF and verify the presence of jedis-2.6.2.

    That should resolve the issue.

提交回复
热议问题