Home >Database >Redis >How to solve the error when springboot configures redis project startup

How to solve the error when springboot configures redis project startup

WBOY
WBOYforward
2023-05-29 11:25:242890browse

Error when configuring the redis project in springboot

When I first started learning redis, I followed the online tutorials to integrate redis and jedis into spring boot. After the integration was completed, the startup project always failed

The following error always pops up

Correct the classpath of your application so that it contains a single, compatible version of org.springframework.data.repository.config.RepositoryConfigurationSource

******************************
APPLICATION FAILED TO START
*** ************************

Description:

An attempt was made to call the method org.springframework. data.repository.config.RepositoryConfigurationSource.getAttribute(Ljava/lang/String;)Ljava/lang/String; but it does not exist. Its class, org.springframework.data.repository.config.RepositoryConfigurationSource, is available from the following locations :

jar:file:/D:/m2/repository/org/springframework/data/spring-data-commons/2.0.10.RELEASE/spring-data-commons-2.0.10.RELEASE.jar !/org/springframework/data/repository/config/RepositoryConfigurationSource.class

It was loaded from the following location:

file:/D:/m2/repository/org/springframework/data /spring-data-commons/2.0.10.RELEASE/spring-data-commons-2.0.10.RELEASE.jar

Action:

Correct the classpath of your application so that it contains a single, compatible version of org.springframework.data.repository.config.RepositoryConfigurationSource

2018-11-22 13:03:51.398 INFO 2196 --- [main] ConfigServletWebServerApplicationContext: Closing org.springframework.boot. web.servlet.context.AnnotationConfigServletWebServerApplicationContext@1a451d4d: startup date [Thu Nov 22 13:03:50 CST 2018]; root of context hierarchy

Process finished with exit code 1

Then I searched online for a long time, but there was no solution to this error. I accidentally saw a blog. It also had a type error when starting the project, and it was also a jar package conflict. Then the blogger changed redis and jedis The version number solved the problem. I also changed the version number to the same as that of the blogger, but the same error still occurred after startup.

Later I thought if I remove all the version numbers and let "spring-boot-starter-parent" automatically provide us with the corresponding version of the jar package, this way I can avoid the possibility of having to specify the version number myself. Some unexpected conflicts. So when I removed the version numbers of redis and jedis, the project started successfully

What a strange error..

How to solve the error when springboot configures redis project startup

Solution to springboot project Redis reports an error during startup

The problem of ERR Client sent AUTH, but no password is set

First look at the part of my springboot configuration redis as shown below:

How to solve the error when springboot configures redis project startup

Obviously the startup password of redis configured above is 123456,

The local redis version is 3.0.1. The requirepass content in the redis.windows.conf file has also changed the password to 123456. Let’s talk about it here. , when removing the # sign in front of requirepass, be sure to note that there is still a space to remove, otherwise an error will be reported:

Invalid argument during startup: unknown conf file parameter : requirepass

At this time, it means that the redis password is consistent with springboot. The next step is to start redis and then springboot.

The method to start Redis is to enter its installation directory, run redis-server.exe, and then start according to the normal process. However, once springboot is started, an error will occur when accessing redis, as shown in the following figure:

How to solve the error when springboot configures redis project startup

At first I thought it was the 2.9.0 redis introduced in my Pom.xml file The version is incompatible due to dependencies. I have been looking for the installation package of Redis 2.9.0 but it is not available online. Half a day wasted.

I later discovered that this error was telling me that I had not set a password. The reason is the wrong method at startup.

Please remember to start local redis. If you set a password, remember to bring the configuration file. The complete startup command is:

redis-server.exe redis.windows.conf

The above is the detailed content of How to solve the error when springboot configures redis project startup. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete