Enable persistence unit post processors configurable in EntityManagerFactoryBuilder
This PR enables persistence unit post processors configurable by implementing EntityManagerFactoryBuilderCustomizer.java. It works only for org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean#internalPersistenceUnitManager.
Comment From: pivotal-issuemaster
@JohnNiang Please sign the Contributor License Agreement!
Click here to manually synchronize the status of this Pull Request.
See the FAQ for frequently asked questions.
Comment From: pivotal-issuemaster
@JohnNiang Thank you for signing the Contributor License Agreement!
Comment From: JohnNiang
@snicoll
If the changes are applied, so that we could customize MutablePersistenceUnitInfo
as follow:
@Bean
EntityManagerFactoryBuilderCustomizer entityManagerFactoryBuilderCustomizer() {
return builder -> {
builder.setPersistenceUnitPostProcessors(pui -> {
pui.addManagedClassName("customized.attribute.converter.class.name");
// other operations on MutablePersistenceUnitInfo
pui...
});
};
}
A scene is that we can register attribute converters into org.hibernate.jpa.boot.spi.EntityManagerFactoryBuilder
programmatically. Because default fetching managed class names
perform is scanning from class path only.
Comment From: snicoll
@JohnNiang thank you for making your first contribution to Spring Boot.