Spring Boot 报错:Error creating bean with name 'entityManagerFactory' defined in class path re

Posted crazyfish

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Spring Boot 报错:Error creating bean with name 'entityManagerFactory' defined in class path re相关的知识,希望对你有一定的参考价值。

spring boot 写一个web项目,在使用spring-data-jpa的时候,启动报如下错误:

Error starting ApplicationContext. To display the auto-configuration report re-run your application with \'debug\' enabled.
2018-04-02 17:00:47.076 ERROR 4648 --- [ main] o.s.boot.SpringApplication : Application startup failed

解决方式:加入依赖既可

    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-entitymanager</artifactId>
      <version>5.0.3.Final</version>
    </dependency>

另外,有看到资料说,在mainApplication中,加如下注解也可以解决:

  @EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})

启动的确不报错了,但是此时,自动创建表功能并未实现,建议用第一种方式。

 

 

以上是关于Spring Boot 报错:Error creating bean with name 'entityManagerFactory' defined in class path re的主要内容,如果未能解决你的问题,请参考以下文章

spring-boot导入redis依赖后报错 Error creating bean with name ‘redisConnectionFactory‘

spring boot 打包报错

Spring Boot 报错:Error creating bean with name 'entityManagerFactory' defined in class path re

使用spring boot 2.1.8生成的maven项目pom.xml第一行报错unknown error

Spring Boot项目Maven Build报错的解决方法

Spring Boot报错Error creating bean with name 'userRepository': Invocation of init method faile