diff --git a/geode-spring-boot/src/main/java/org/springframework/geode/security/support/SecurityManagerProxy.java b/geode-spring-boot/src/main/java/org/springframework/geode/security/support/SecurityManagerProxy.java index 928bc96a..fb9e13cd 100644 --- a/geode-spring-boot/src/main/java/org/springframework/geode/security/support/SecurityManagerProxy.java +++ b/geode-spring-boot/src/main/java/org/springframework/geode/security/support/SecurityManagerProxy.java @@ -24,6 +24,7 @@ import java.util.concurrent.atomic.AtomicReference; import org.apache.geode.security.AuthenticationFailedException; import org.apache.geode.security.ResourcePermission; +import org.springframework.beans.factory.DisposableBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.gemfire.support.LazyWiringDeclarableSupport; import org.springframework.util.Assert; @@ -69,7 +70,7 @@ import org.springframework.util.Assert; */ @SuppressWarnings("unused") public class SecurityManagerProxy extends LazyWiringDeclarableSupport - implements org.apache.geode.security.SecurityManager { + implements org.apache.geode.security.SecurityManager, DisposableBean { private static final AtomicReference INSTANCE = new AtomicReference<>(); @@ -87,7 +88,6 @@ public class SecurityManagerProxy extends LazyWiringDeclarableSupport .orElseThrow(() -> newIllegalStateException("SecurityManagerProxy was not configured")); } - /** * Constructs a new instance of {@link SecurityManagerProxy}, which will delegate all Apache Geode * security operations to a Spring managed {@link org.apache.geode.security.SecurityManager} bean. @@ -154,4 +154,10 @@ public class SecurityManagerProxy extends LazyWiringDeclarableSupport public void close() { getSecurityManager().close(); } + + @Override + public void destroy() throws Exception { + super.destroy(); + INSTANCE.set(null); + } }