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