Spring Boot 報錯:Error creating bean with name 'entityManagerFactory' defined in class path resource


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})

啟動的確不報錯了,但是此時,自動創建表功能並未實現,建議用第一種方式。

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM