Tag Archives: a bean named ‘entityManagerFactory’ that could not be found

Springboot import JPA Error: 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.

Because it’s a previous project, now I report an error. It’s said on the Internet to delete the package under hibernate in Maven warehouse, but it’s no use trying it; Later, I wondered if it was the version of springboot

So in the POM. XML file

The version of springboot starts from

<version>2.1.1.RELEASE</version>

Change to

<version>2.1.4.RELEASE</version>

Project ready to run

Another mistake

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

You need to add the

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