Reason: Failed to determine a suitable driver class
問題詳情如下:
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-06-03 15:48:45.482 ERROR 3056 --- [ 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
錯誤說明:未能配置數據源:未指定“url”屬性,無法配置嵌入的數據源。
解決方法:
在 pom.xml 配置文件中,加入JDBC 依賴包,在啓動配置文件時 ,Spring Boot 的自動裝配機制就會去配置文件中找,相關的數據庫的連接配置信息,如果找不到則拋出異常信息
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
</dependency>
修改配置後,測試是否能正常啓動,如下圖所示: