SpringBoot啟動(dòng)報(bào)錯(cuò)Failed to determine a suitable driver class
SpringBoot啟動(dòng)報(bào)錯(cuò)如下
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-05-06 21:27:18.275 ERROR 10968 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :***************************
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).
Process finished with exit code 1
把這個(gè)依賴注釋掉就好了
原因
應(yīng)用沒有使用到DataSource,但是在pom.xml里引入了mybatis-spring-boot-starter
問題解決辦法
有兩種:
把mybatis-spring-boot-starter的依賴去掉,這樣就不會(huì)觸發(fā)spring boot相關(guān)的代碼
把spring boot自動(dòng)初始化DataSource相關(guān)的代碼禁止掉
禁止的辦法有兩種:
在啟動(dòng)類的@SpringBootApplication加上
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class, DataSourceTransactionManagerAutoConfiguration.class })
在application.properties里配置:
spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
- springboot啟動(dòng)feign項(xiàng)目報(bào)錯(cuò):Service id not legal hostnam的解決
- SpringBoot啟動(dòng)自動(dòng)終止也不報(bào)錯(cuò)的原因及解決
- SpringBoot啟動(dòng)訪問localhost:8080報(bào)錯(cuò)404的解決操作
- 解決springboot服務(wù)啟動(dòng)報(bào)錯(cuò):Unable?to?start?embedded?contain
- 解決Springboot啟動(dòng)報(bào)錯(cuò):類文件具有錯(cuò)誤的版本61.0,應(yīng)為?52.0
相關(guān)文章
SpringMVC請(qǐng)求的路徑變量里面寫正則表達(dá)式的方法
這篇文章主要介紹了SpringMVC請(qǐng)求的路徑變量里面寫正則表達(dá)式的相關(guān)知識(shí),本文給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2019-09-09SpringBoot整合Mybatis-plus實(shí)現(xiàn)多級(jí)評(píng)論功能
本文介紹了如何使用SpringBoot整合Mybatis-plus實(shí)現(xiàn)多級(jí)評(píng)論功能,同時(shí)提供了數(shù)據(jù)庫(kù)的設(shè)計(jì)和詳細(xì)的后端代碼,前端界面使用的Vue2,本文通過實(shí)例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友參考下吧2023-05-05SpringBoot任務(wù)之定時(shí)任務(wù)相關(guān)知識(shí)總結(jié)
今天給大家整理的文章是SpringBoot定時(shí)任務(wù)的相關(guān)知識(shí)點(diǎn),文中有非常詳細(xì)的介紹及代碼示例,對(duì)正在學(xué)習(xí)SpringBoot任務(wù)的小伙伴們很有幫助,需要的朋友可以參考下2021-06-06Java實(shí)現(xiàn)支付對(duì)接常用加密方式的示例代碼
這篇文章主要為大家詳細(xì)介紹了Java如何實(shí)現(xiàn)支付對(duì)接時(shí)常用加密方式,文中的示例代碼講解詳細(xì),對(duì)我們學(xué)習(xí)Java有一點(diǎn)幫助,需要的可以參考一下2023-02-02SpringBoot中各個(gè)層級(jí)結(jié)構(gòu)的具體實(shí)現(xiàn)
在SpringBoot項(xiàng)目中,常常會(huì)把代碼文件放入不同的包中,本文主要介紹了SpringBoot中各個(gè)層級(jí)結(jié)構(gòu)的具體實(shí)現(xiàn),具有一定的參考價(jià)值,感興趣的可以了解一下2024-05-05Java中常用解析工具jackson及fastjson的使用
今天給大家?guī)?lái)的是關(guān)于Java解析工具的相關(guān)知識(shí),文章圍繞著jackson及fastjson的使用展開,文中有非常詳細(xì)的介紹及代碼示例,需要的朋友可以參考下2021-06-06Jackson使用示例-Bean、XML、Json之間相互轉(zhuǎn)換
Jackson是一個(gè)強(qiáng)大工具,可用于Json、XML、實(shí)體之間的相互轉(zhuǎn)換,JacksonXmlElementWrapper用于指定List等集合類,外圍標(biāo)簽名,JacksonXmlProperty指定包裝標(biāo)簽名,或者指定標(biāo)簽內(nèi)部屬性名,JacksonXmlRootElement指定生成xml根標(biāo)簽的名字,JacksonXmlText指定當(dāng)前這個(gè)值2024-05-05