0

我有一個Spring Data JPA項目來訪問我的數據庫並檢索用戶憑據。我將這個項目打包成一個jar(不是可執行的jar),並將它作爲Maven依賴項包含到另一個Spring引導項目中,因爲我想重用之前開發的相同實體和存儲庫。每次我跑我的春節,引導應用程序時,我得到這個錯誤:使用spring data jpa項目檢索用戶的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:我不想與控制器和服務項目

+0

我認爲您在類路徑中缺少DB JAR。 – hrdkisback

+0

我 ' org.postgresql PostgreSQL的 9.4.1212.jre7 ' –

+0

在春季啓動應用程序? – hrdkisback

回答

0

前段時間我得到了同樣的錯誤,以混合JPA項目,我修復它添加此:

@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); 
    } 
} 
相關問題