【发布时间】:2017-11-07 07:09:12
【问题描述】:
我有一个 Spring Data JPA 项目来访问我的数据库并检索用户凭据。我将此项目打包为 jar(不是可执行 jar)并将其作为 maven 依赖项包含到另一个 Spring boot 项目中,因为我想重用之前开发的相同实体和存储库。每次我运行我的 Spring Boot 应用程序时,我都会收到此错误:
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).
我开始怀疑我正在做的事情是否可能? PS:我不想将 JPA 项目与控制器和服务项目混在一起
【问题讨论】:
-
我认为您的类路径中缺少 DB JAR。
-
我有
<dependency> <groupId>org.postgresql</groupId> <artifactId>postgresql</artifactId> <version>9.4.1212.jre7</version> </dependency> -
在 Spring Boot 应用程序中?
-
是的,我两个都有
-
你添加了'spring.database.driverClassName=org.postgresql.Driver'驱动类名吗?
标签: maven spring-boot spring-security spring-data spring-data-jpa