Springboot引入JPA,出現a bean named 'entityManagerFactory' that could not be found


***************************
APPLICATION FAILED TO START
***************************

Description:

Field usuarioDao in es.uc3m.tiw.Controladores.Controlador required a bean named 'entityManagerFactory' that could not be found.

Action:

Consider defining a bean named 'entityManagerFactory' in your configuration.

因為是之前的項目, 現在報錯, 網上說的刪除maven倉庫hibernate下的包, 試了也沒用; 后來想是不是springboot版本問題,

於是在pom.xml文件中將

springboot的版本從

<version>2.1.1.RELEASE</version>

改成

<version>2.1.4.RELEASE</version>

項目即可運行...

  

另外一個錯誤

***************************
APPLICATION FAILED TO START
***************************

Description:

Field roleRepository in top.wujinxing.ch15jpa.controller.RoleController required a bean of type 'top.wujinxing.ch15jpa.dao.RoleRepository' that could not be found.

The injection point has the following annotations:
    - @org.springframework.beans.factory.annotation.Autowired(required=true)

Action:

Consider defining a bean of type 'top.wujinxing.ch15jpa.dao.RoleRepository' in your configuration.

Process finished with exit code 1

需要在項目入口添加

@ComponentScan(basePackages = "top.wujinxing.ch15jpa.dao")


免責聲明!

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



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