Failed to configure a DataSource 'url' attribute問題解決

才寫了一行代碼又報錯了..spring

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

Disconnected from the target VM, address: '127.0.0.1:58792', transport: 'socket'

Process finished with exit code 0

未指定「url」屬性,沒法配置嵌入的數據源。數據庫

緣由:因爲添加了數據庫組件,因此autoconfig會去讀取數據源配置,新建的項目尚未配置數據源,因此會致使異常出現。springboot

解決辦法:
在啓動類添加以下內容
即:@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})

轉自:悟世君子的博客app

相關文章
相關標籤/搜索