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

After tossing all afternoon, I began to think that it was the problem of using JPA warehouse. I replaced the simplest JPA repository, but it still couldn’t work. I checked online and tried the following methods:

Delete the version number;

Delete all the files in the folder (. M2) and then import the package again by Maven;

At a loss, I found that I had commented on the main startup class

@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)

It’s equivalent to not allowing automatic injection of data source. Of course, entitymanagerfactory can’t be found…

Hope to be able to help small partners who encounter the same difficulties!

Read More: