Description
Niko Wittenbeck opened SPR-16828 and commented
Hi there,
using Spring 5.0.6 and a custom LocalSessionFactoryBean for Hibernate 5, I'd like to register a Hibernate integrator progammatically. This needs to be done via BootstrapServiceRegistryBuilder#applyIntegrator.
In the LocalSessionFactory bean, BootstrapServiceRegistryBuilder is only aquired in getMetadataSources():
public MetadataSources getMetadataSources() {
(...)
BootstrapServiceRegistryBuilder builder = new BootstrapServiceRegistryBuilder();
(...)
this.metadataSources = new MetadataSources(builder.build());
}
return this.metadataSources;
}
This means, in order to simply apply an integrator, I have to override getMetadataSources to apply additional stuff to the BootstrapServiceRegistryBuilder. As private fields are used (metadataSourcesAccessed, metadataSources), ugly code duplication needs to be done.
So IMHO it would be great if the builder could easily be accessed in another way.
Affects: 5.0.6
Issue Links:
- Support Hibernate 5.3's ManagedBeanRegistry for dependency injection [SPR-16305] #20852 Support Hibernate 5.3's ManagedBeanRegistry for dependency injection
- Hibernate 5: restore ability to inject "cacheRegionFactory" of LocalSessionFactoryBean [SPR-17043] #21581 Hibernate 5: restore ability to inject "cacheRegionFactory" of LocalSessionFactoryBean
Referenced from: commits b6d9556