【发布时间】:2018-09-03 15:16:51
【问题描述】:
我从 SPRING INITIALIZR 创建了一个基本的 Spring Boot 应用程序,其中包含 Web、MongoDB 和 JPA 依赖项。
当我尝试运行 spring boot 应用程序时,出现以下异常:
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-03-25 16:27:02.807 ERROR 16256 --- [ restartedMain] 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 situation:
If you want an embedded database like H2, HSQL or Derby, please add it in the Classpath.
If you have database settings to be loaded from a particular profile you may need to activate it since no profiles were currently active.
在 application.properties 文件中,我有以下配置:
server.port=8081
spring.data.mongodb.database=TestDatabase
spring.data.mongodb.host=localhost
spring.data.mongodb.port=27017
我使用的版本: 弹簧:5.0.4, MongoDB:3.6, 春季启动:2.0
【问题讨论】:
标签: java spring mongodb spring-boot spring-data-jpa