Example usage for org.hibernate.boot.registry BootstrapServiceRegistryBuilder applyClassLoader

List of usage examples for org.hibernate.boot.registry BootstrapServiceRegistryBuilder applyClassLoader

Introduction

In this page you can find the example usage for org.hibernate.boot.registry BootstrapServiceRegistryBuilder applyClassLoader.

Prototype

public BootstrapServiceRegistryBuilder applyClassLoader(ClassLoader classLoader) 

Source Link

Document

Adds a provided ClassLoader for use in class-loading and resource-lookup.

Usage

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;
}