啟動項目的時候報錯:
Description:
Failed to auto-configure a DataSource: 'spring.datasource.url' is not specified and no embedded datasource could be auto-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).
查看target目錄下的包,發現class目錄下沒有將resources的conf/properties打包進去,連接數據庫的時候找不到對應配置。自然拋出spring.datasource.url未找到的錯誤。
暫未找到為什么無法打包進去的原因。在pom文件增加一段配置解決此問題
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
<finalName>ROOT</finalName>
</build>