springboot 啓動時報,Failed to determine a suitable driver class 的排查順序

如果你這個項目真的沒有數據庫相關的依賴:把mybatis的相關依賴去掉後,RELOAD MAVEN 依賴,然後重新啓動就好了。

-------------------------------------------

這個問題真的超級頻繁了,新項目寫一個遇到一次,每次還都要踩這個坑,畢竟這玩意太瑣碎了,現在寫一下排查順序:


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

Description:

Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

Reason: Failed to determine a suitable driver class


Action:

Consider the following:
    If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
    If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).
 

在自己確定配置文件沒寫錯的情況下:

1,先看自己的配置文件名字是不是application-xxx.yml

2,再看resource文件夾有沒有mark爲resources Root文件夾

3,看看啓動時配置文件是不是啓動到了這個xxx上(edit configurations)

 

如果上面三步沒有查出問題,打包,打包完了yml配置文件應該在:.jar\BOOT-INF\classes路徑下,如果沒有就好好再看上面第2步,第2步沒問題就去查pom裏面的build插件,看看build的文件夾對不對

如果上面這步沒問題,就好好再回去檢查檢查1、2、3

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章