建立spring boot專案後啟動報錯
阿新 • • 發佈:2018-12-21
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).
原因:建立專案的時候我添加了資料庫元件,但是啟動時還沒有配置資料來源,所以會報錯,可以先新增
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
然後專案成功啟動。