使用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

相关文章:

  • 2021-06-26
  • 2022-12-23
  • 2021-11-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-29
猜你喜欢
  • 2021-07-01
  • 2021-04-04
  • 2021-10-31
  • 2021-06-15
  • 2021-04-15
  • 2021-09-16
  • 2022-12-23
相关资源
相似解决方案