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版本問題,spring

因而在pom.xml文件中將springboot

springboot的版本從maven

<version>2.1.1.RELEASE</version>

改爲ide

<version>2.1.4.RELEASE</version>

項目便可運行...ui

  

另一個錯誤spa

*************************** 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

須要在項目入口添加hibernate

@ComponentScan(basePackages = "top.wujinxing.ch15jpa.dao")
相關文章
相關標籤/搜索