Skip to content

Commit 0866aa9

Browse files
committed
LocalSessionFactoryBuilder provides ClassLoader to Hibernate BootstrapServiceRegistry
Issue: SPR-13879
1 parent d152259 commit 0866aa9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

spring-orm-hibernate5/src/main/java/org/springframework/orm/hibernate5/LocalSessionFactoryBuilder.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -30,6 +30,7 @@
3030

3131
import org.hibernate.HibernateException;
3232
import org.hibernate.MappingException;
33+
import org.hibernate.boot.registry.BootstrapServiceRegistryBuilder;
3334
import org.hibernate.cfg.AvailableSettings;
3435
import org.hibernate.cfg.Configuration;
3536
import org.hibernate.cfg.Environment;
@@ -106,6 +107,8 @@ public LocalSessionFactoryBuilder(DataSource dataSource, ClassLoader classLoader
106107
* @param resourceLoader the ResourceLoader to load application classes from
107108
*/
108109
public LocalSessionFactoryBuilder(DataSource dataSource, ResourceLoader resourceLoader) {
110+
super(new BootstrapServiceRegistryBuilder().applyClassLoader(resourceLoader.getClassLoader()).build());
111+
109112
getProperties().put(Environment.CURRENT_SESSION_CONTEXT_CLASS, SpringSessionContext.class.getName());
110113
if (dataSource != null) {
111114
getProperties().put(Environment.DATASOURCE, dataSource);

0 commit comments

Comments
 (0)