【发布时间】:2019-02-21 11:27:15
【问题描述】:
我正在尝试在 Spring Boot 和 Spring Cloud 上构建示例应用程序。 我已经在桌面上的 config.properties 属性文件中编写了我的数据库和休眠配置,我希望我的 spring boot 能够使用这个配置。
我的项目有 3 个模块
- API
- 数据层
- 服务层
这是我在API的application.property文件中提到的代码
spring.profiles.active=native spring.cloud.config.server.native.searchLocation=C:/Users/DEV/Desktop/configuration/config.properties
DataLayer和ServiceLayer的属性文件为空
但是当我运行 API 时出现以下错误
***************************
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
谁能帮我解决这个错误。
提前致谢。
【问题讨论】:
-
你能分享一下属性文件的 spring.datasource.url 部分吗(当然没有任何敏感信息)?好像不见了。还要仔细检查您的 Spring Data 依赖项。
标签: java spring-boot spring-cloud spring-cloud-config