List of usage examples for org.hibernate.boot.registry BootstrapServiceRegistryBuilder applyClassLoader
public BootstrapServiceRegistryBuilder applyClassLoader(ClassLoader classLoader)
From source file:com.baomidou.hibernateplus.HibernateSpringSessionFactoryBean.java
License:Apache License
/** * Determine the Hibernate {@link MetadataSources} to use. * <p>//from w w w . j a v a 2s .c o m * Can also be externally called to initialize and pre-populate a * {@link MetadataSources} instance which is then going to be used for * {@link SessionFactory} building. * * @return the MetadataSources to use (never {@code null}) * @see HibernateSpringSessionFactoryBuilder#HibernateSpringSessionFactoryBuilder(DataSource, * ResourceLoader, MetadataSources) * @since 4.3 */ public MetadataSources getMetadataSources() { if (this.metadataSources == null) { BootstrapServiceRegistryBuilder builder = new BootstrapServiceRegistryBuilder(); if (this.resourcePatternResolver != null) { builder = builder.applyClassLoader(this.resourcePatternResolver.getClassLoader()); } this.metadataSources = new MetadataSources(builder.build()); } return this.metadataSources; }