From 501891c749b838360a763ffeb3ddd09150b814a1 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Fri, 30 Jun 2017 20:57:15 +0200 Subject: [PATCH] FactoryBean object cache cleared on shutdown Issue: SPR-15722 (cherry picked from commit 6534359) --- .../factory/support/FactoryBeanRegistrySupport.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/FactoryBeanRegistrySupport.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/FactoryBeanRegistrySupport.java index 53dc17657e..1170486bee 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/FactoryBeanRegistrySupport.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/FactoryBeanRegistrySupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -223,7 +223,16 @@ public abstract class FactoryBeanRegistrySupport extends DefaultSingletonBeanReg } /** - * Returns the security context for this bean factory. If a security manager + * Overridden to clear the FactoryBean object cache as well. + */ + @Override + public void destroySingletons() { + super.destroySingletons(); + this.factoryBeanObjectCache.clear(); + } + + /** + * Return the security context for this bean factory. If a security manager * is set, interaction with the user code will be executed using the privileged * of the security context returned by this method. * @see AccessController#getContext()