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

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

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

估計是跟多個數據源有關,改爲以下這樣就能夠了spring

    @SpringBootApplication    
    @EnableAutoConfiguration(exclude={    
          JpaRepositoriesAutoConfiguration.class//禁止springboot自動加載持久化bean  
            })    
    @ImportResource({"classpath:spring-servlet.xml"})    
    public class JzApplication {    
            
        public static void main(String[] args) throws Exception {    
            ApplicationContext ctx = SpringApplication.run(JzApplication .class,args);    
        }    
    }   

緣由:可能在啓動其餘項目的時候,一些持久化的bean被加載了,致使這種狀況springboot

 

參考地址:http://blog.csdn.net/terry7/article/details/51996979spa

相關文章
相關標籤/搜索