JPA: Spring Boot will not search for `META-INF/persistence.xml`
What I learned today — 21 August 2018
1 min readAug 21, 2018
Spring Boot will now ignore persistence.xml
and orm.xml
files by default. From the documentation:
Spring Boot will not search for or use a
META-INF/persistence.xml
by default. If you prefer to use a traditionalpersistence.xml
, you need to define your own@Bean
of typeLocalEntityManagerFactoryBean
(with an ID of ‘entityManagerFactory’) and set the persistence unit name there.
This also means that you can’t use orm.xml
to override annotations on your entities without configuring this bean. Doing that in a boot app may not be trivial.