首頁  >  文章  >  資料庫  >  springboot配置redis專案啟動時錯誤怎麼解決

springboot配置redis專案啟動時錯誤怎麼解決

WBOY
WBOY轉載
2023-05-29 11:25:242819瀏覽

springboot設定redis專案啟動時的錯誤

在剛開始學redis時,我照著網路上的教程,把redis和jedis整合到spring boot,整合完畢後,啟動專案總是失敗

總是爆出下面的錯誤

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, org.springframework.data.repository.config.RepositoryConfigurationSource, org.springframework.data.repository.config.RepositoryConfigurationSource, org :
 
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] 13:03:51.398 INFO 2196 --- [ main]] ConfigSerral.Server. web.servlet.context.AnnotationConfigServletWebServerApplicationContext@1a451d4d: startup date [Thu Nov 22 13:03:50 CST 2018]; root of context hierarchy
 ##ProcessProcess finished with 1#然後我在網上找了很久,都沒有關於這個錯誤的解決辦法,偶然看到一篇博客,它在啟動項目時也出現了類型錯誤,也是jar包衝突,然後那個博主是通過改redis和jedis的版本號碼解決的,我也把版本號碼都改成跟那個部落客相同的,但啟動後還是出現相同的錯誤。

後來就想如果我把版本號碼都去掉,讓「spring-boot-starter-parent」自動為我們提供對應版本的jar包,這樣就可以避免自己指定版本號時,可能會有一些意想不到的衝突。因此,當我移除了redis和jedis的版本號時,專案成功地啟動了

What a strange error..

解決springboot項目啟動時redis報錯

springboot配置redis專案啟動時錯誤怎麼解決出現ERR Client sent AUTH, but no password is set的問題

首先看下我springboot配置redis的部分如圖:

#顯然上面配置了redis的啟動密碼為123456,

springboot配置redis專案啟動時錯誤怎麼解決本地redis版本為3.0.1 在redis.windows.conf檔案中requirepass內容也修改了密碼為123456,這裡說下,在移除requirepass前面的#號時一定注意還有一個空格要去除,不然會報錯:

Invalid argument during startup: unknown conf file parameter :  requirepass

# #這時,說明redis密碼與springboot的一致,接下來就是啟動redis再啟動springboot。

啟動Redis的方法是進入其安裝目錄,執行redis-server.exe,然後依照正常流程啟動。然而一旦啟動了springboot,訪問redis就會出錯,如下圖所示:

#一開始以為是我Pom.xml檔案中引入的為2.9.0的redis依賴導致的版本不相容,一直去找Redis的2.9.0的安裝包竟然網路上沒有。浪費了半天。

springboot配置redis專案啟動時錯誤怎麼解決後來才發現,這個報錯是告訴我沒有設定密碼。原因就是啟動時的方法錯誤。

請務必記住,啟動本地redis,如果設定了密碼記得帶上設定文件,啟動命令完整為:

redis-server.exe redis.windows.conf

以上是springboot配置redis專案啟動時錯誤怎麼解決的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文轉載於:yisu.com。如有侵權,請聯絡admin@php.cn刪除