SpringBoot啓動報:Caused by: java.lang.IllegalArgumentException: At least one JPA metamodel must be

使用spring boot對項目改造,啓動報錯:

Caused by: java.lang.IllegalArgumentException: At least one JPA metamodel must be present!

估計是跟多個數據源有關,改成如下這樣就可以了:

@SpringBootApplication
@EnableAutoConfiguration(exclude={
        JpaRepositoriesAutoConfiguration.class//禁止springboot自動加載持久化bean
})
public class DemoApplication {
    //spring應用啓動應用
    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }
}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章