我有一个Spring Data JPA项目来访问我的数据库并检索用户凭据。我将这个项目打包为jar(不是可执行的jar),并将其作为maven依赖包含在另一个Spring启动项目中,因为我想重用之前开发的相同实体和存储库。每次运行Spring Boot Application时都会出现此错误:
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项目与控制器和服务项目混合
答案 0 :(得分:0)
前段时间我遇到了同样的错误,我解决了这个错误:
@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
到引导类,例如:
package com.adapter;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
@SpringBootApplication
@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
public class DBAdapterApplication {
public static void main(String[] args) {
SpringApplication.run(DBAdapterApplication.class, args);
}
}