内射老阿姨1区2区3区4区_久久精品人人做人人爽电影蜜月_久久国产精品亚洲77777_99精品又大又爽又粗少妇毛片

Springboot啟動提示數(shù)據(jù)源錯誤怎么辦

這篇文章主要介紹了Spring boot 啟動提示數(shù)據(jù)源錯誤怎么辦,具有一定借鑒價值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓小編帶著大家一起了解一下。

創(chuàng)新互聯(lián)于2013年成立,先為沈北新等服務(wù)建站,沈北新等地企業(yè),進行企業(yè)商務(wù)咨詢服務(wù)。為沈北新企業(yè)網(wǎng)站制作PC+手機+微官網(wǎng)三網(wǎng)同步一站式服務(wù)解決您的所有建站問題。

在啟動 Spring Boot 的項目的時候提示數(shù)據(jù)源未配置的錯誤。

09:52:08.333 [main] DEBUG o.s.b.d.LoggingFailureAnalysisReporter - Application failed to start due to an exceptionorg.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver classat org.springframework.boot.autoconfigure.jdbc.DataSourceProperties.determineDriverClassName(DataSourceProperties.java:233)	at org.springframework.boot.autoconfigure.jdbc.DataSourceProperties.initializeDataSourceBuilder(DataSourceProperties.java:174)

Spring 會提示你完整的導(dǎo)致啟動錯誤的信息是:

***************************
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

錯誤分析

從上面的啟動信息來看,已經(jīng)說得非常清楚了,就是因為你配置了 Spring 的數(shù)據(jù)組件,但是你沒有配置相應(yīng)的數(shù)據(jù)源。

因為這個會導(dǎo)致你的啟動失敗。

解決辦法

有下面的集中解決辦法:

加入 H2 包

最簡單的解決辦法就是在依賴中添加 H2 的數(shù)據(jù)庫,如果你使用 Spring Batch 的話,這個組件也是需要的,因為 Spring 會使用 H2 為數(shù)據(jù)源。

添加數(shù)據(jù)源配置

如果你已經(jīng)添加了數(shù)據(jù)庫驅(qū)動,例如你添加了 MySQL 的數(shù)據(jù)庫驅(qū)動。

那么你需要制定 Mysql 的數(shù)據(jù)庫連接參數(shù)。

spring.datasource.url=jdbc:mysql://localhost:3306/myDbspring.datasource.username=user1spring.datasource.password=passspring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

在啟動時候不載入數(shù)據(jù)源配置。

你可用在啟動的時候不載入數(shù)據(jù)源配置。

可用在啟動類上面,添加下面的注解。

@SpringBootApplication(exclude={DataSourceAutoConfiguration.class})

Spring boot 啟動提示數(shù)據(jù)源錯誤怎么辦

你也可以在啟動配置文件上面,添加下面的內(nèi)容,這樣能夠保證你在啟動的時候不載入數(shù)據(jù)源配置類。

spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAuto

感謝你能夠認真閱讀完這篇文章,希望小編分享的“Spring boot 啟動提示數(shù)據(jù)源錯誤怎么辦”這篇文章對大家有幫助,同時也希望大家多多支持創(chuàng)新互聯(lián),關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,更多相關(guān)知識等著你來學(xué)習(xí)!

標題名稱:Springboot啟動提示數(shù)據(jù)源錯誤怎么辦
文章鏈接:http://www.rwnh.cn/article0/pgcoio.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供商城網(wǎng)站企業(yè)網(wǎng)站制作、網(wǎng)站設(shè)計、電子商務(wù)、ChatGPT、關(guān)鍵詞優(yōu)化

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

網(wǎng)站建設(shè)網(wǎng)站維護公司
集贤县| 屏南县| 漾濞| 沁源县| 偏关县| 佛山市| 黄龙县| 汉川市| 莱阳市| 珠海市| 高雄市| 桂阳县| 凤冈县| 烟台市| 明星| 塔河县| 白朗县| 金湖县| 五原县| 乌鲁木齐县| 建水县| 崇明县| 瑞昌市| 高要市| 友谊县| 贵德县| 临朐县| 武安市| 镇巴县| 英吉沙县| 鄯善县| 霍邱县| 蒲江县| 赣州市| 星座| 汉沽区| 临高县| 张家口市| 于都县| 兴城市| 玉环县|