Spring boot Spring启动错误

Spring boot Spring启动错误,spring-boot,Spring Boot,当我尝试运行SpringBoot应用程序时,我得到了以下错误 starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2018-05-03 10:50:09.457 ERROR 4909 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter : *********

当我尝试运行SpringBoot应用程序时,我得到了以下错误

starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2018-05-03 10:50:09.457 ERROR 4909 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

*************************** APPLICATION FAILED TO START
***************************

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

如果要自动配置数据源,请将配置详细信息放在
application.properties
文件中。类似这样的内容(MySQL的配置)


如果要自动配置数据源,请将配置详细信息放在
application.properties
文件中。类似这样的内容(MySQL的配置)


如果您想使用非嵌入式数据源,上述答案是正确的。如果要使用嵌入式数据源,只需将以下依赖项添加到pom.xml:


com.h2数据库
氢
运行时

如果要在测试中使用嵌入式数据源,请将作用域更改为“测试”,而不是“运行时”。

如果要使用非嵌入式数据源,上述答案是正确的。如果要使用嵌入式数据源,只需将以下依赖项添加到pom.xml:


com.h2数据库
氢
运行时

如果要在测试中使用嵌入式数据源,请将作用域更改为test而不是runtime。

pom.xml中是否包含
spring boot starter数据jpa
?它将假定您将处理一个数据存储。请发布pom或gradle文件的片段,以及您的application.properties是否在application.properties或yml文件中包含
spring.datasource.url
?pom.xml中是否包含
spring boot starter数据jpa
?它将假定您将处理一个数据存储。请发布pom或gradle文件的片段,以及您的application.properties是否在application.properties或yml文件中包含
spring.datasource.url
spring.datasource.url=jdbc:mysql://localhost/test
spring.datasource.username=dbuser
spring.datasource.password=dbpass
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
<dependency>
    <groupId>com.h2database</groupId>
    <artifactId>h2</artifactId>
    <scope>runtime</scope>
</dependency>