With Spring Boot 1.x, we could specify hibernate mapping files by extending HibernateJpaAutoConfiguration
, overriding LocalContainerEntityManagerFactoryBean
bean and set mapping resources, like in this answer.
Since Spring Boot 2.0 (2.0.0.M5 precisly), we can’t do this anymore because HibernateJpaAutoConfiguration
has changed (with this commit) and we can’t extend the HibernateJpaConfiguration
because it is package protected.
Do you know another way to specify hibernate mapping files using Spring Boot 2.0?
Thanks!
Since Spring Boot 2.0.0.M6, rather than overriding Spring Boot's internal, you should use the new spring.jpa.mapping-resources
property for defining custom mappings.
Example in YML:
spring:
jpa:
mapping-resources:
- db/mappings/dummy.xml
For a complete example, check the application.yml
configuration file of this repository.