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


使用spring boot对项目改造,启动报错:

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

估计是跟多个数据源有关,改成如下这样就可以了

    @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被加载了,导致这种情况

 

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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM