Skip to content
Advertisement

Should Spring Boot Data JPA automatically create EntityManagerFactory bean?

Should Spring Boot Data JPA automatically create EntityManagerFactory bean?

I have added a table using Liquibase called Fred to my code, and now I wish to add JPA support for this.

Upon adding:

JavaScript

I get

JavaScript

I understood that this bean should be created by spring. Can anyone explain when spring creates this bean for me? If it doesn’t, why not?

SpringBoot TRACE logs containing EntityManager

JavaScript

Entity class:

JavaScript

pom.xml (recently added spring-boot-starter-data-jpa)

JavaScript

version numbers from parent

JavaScript

stack trace

JavaScript

application.yml

JavaScript

Advertisement

Answer

It turns out I was missing the hibernate jars in my pom.

JavaScript

Also worth pointing out that hibernate 6 requires spring boot 3 and doesn’t work with spring boot 2.

Advertisement