springboot項目在啓動時,報以下錯誤:mysql
Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled. 2019-09-09 20:47:28.395 ERROR 16240 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter : *************************** APPLICATION FAILED TO START *************************** Description: Cannot determine embedded database driver class for database type NONE Action: If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).
緣由:spring
在項目的pom.xml文件中有引入數據庫的配置,以下,但在實際上在項目中沒有配置數據庫的連接,因此報錯。sql
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jdbc</artifactId> </dependency>
解決方案:數據庫
在項目的application.properties配置數據庫的連接。springboot
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/cds
spring.datasource.username=cds
spring.datasource.password=cds