SessionFactory objects created by
SessionFactoryBuilderSupport#buildSessionFactory are now DisposableBean
proxies that call SessionFactory#close and release any threadlocal
DataSource object.
This is the same behavior that has always occurred during LSFBean and
ASFBean destruction lifecycles (and still does). This destruction logic
has now been factored out into
SessionFactoryBuilderSupport#closeHibernateSessionFactory such that all
SFB types can reuse it easily.
Note that LSFBean and ASFBean are subclasses, respectively, of SFBuilder
and ASFBuilder and they each must disable the DisposableBean proxying in
order to avoid duplicate attempts at closing the SessionFactory. See
the implementations of wrapSessionFactoryIfNeccesary() for details.
Issue: SPR-8114
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4240 50f2f4bb-b051-0410-bef5-90022cba6387
@ -130,6 +133,16 @@ public class HibernateSessionFactoryConfigurationTests {
@@ -130,6 +133,16 @@ public class HibernateSessionFactoryConfigurationTests {
@ -110,6 +110,11 @@ public class LocalSessionFactoryBean extends SessionFactoryBuilder implements Se
@@ -110,6 +110,11 @@ public class LocalSessionFactoryBean extends SessionFactoryBuilder implements Se
@ -115,23 +113,7 @@ public class SessionFactoryBeanDelegate implements SessionFactoryBeanOperations
@@ -115,23 +113,7 @@ public class SessionFactoryBeanDelegate implements SessionFactoryBeanOperations
@ -142,6 +124,11 @@ public class SessionFactoryBeanDelegate implements SessionFactoryBeanOperations
@@ -142,6 +124,11 @@ public class SessionFactoryBeanDelegate implements SessionFactoryBeanOperations
@ -552,16 +558,37 @@ public abstract class SessionFactoryBuilderSupport<This extends SessionFactoryBu
@@ -552,16 +558,37 @@ public abstract class SessionFactoryBuilderSupport<This extends SessionFactoryBu
@ -1409,4 +1436,24 @@ public abstract class SessionFactoryBuilderSupport<This extends SessionFactoryBu
@@ -1409,4 +1436,24 @@ public abstract class SessionFactoryBuilderSupport<This extends SessionFactoryBu
@ -134,6 +135,11 @@ public class AnnotationSessionFactoryBean extends AnnotationSessionFactoryBuilde
@@ -134,6 +135,11 @@ public class AnnotationSessionFactoryBean extends AnnotationSessionFactoryBuilde