[java-shib-shared] 04/09: JSSH-71 Remove the impact of the DestructableComponent Interface

Codeberg noreply at shibboleth.net
Thu Jul 9 10:48:38 UTC 2026


This is an automated email from the git hooks/post-receive script.

codeberg pushed a commit to branch main
in repository java-shib-shared.

View the commit online:
https://codeberg.org/Shibboleth/java-shib-shared/commit/5841de904c281248126a7d99b0fb4dae32f537cc

commit 5841de904c281248126a7d99b0fb4dae32f537cc
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Mon Jul 6 15:18:42 2026 +0100

    JSSH-71 Remove the impact of the DestructableComponent Interface
    
    https://shibboleth.atlassian.net/browse/JSSH-71
    
    Call any annotated tear down points in any singleton instances.
---
 .../spring/httpclient/factory/FileCachingHttpClientFactoryBean.java   | 4 ++++
 .../shared/spring/factory/AbstractComponentAwareFactoryBean.java      | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/shib-networking-spring/src/main/java/net/shibboleth/shared/spring/httpclient/factory/FileCachingHttpClientFactoryBean.java b/shib-networking-spring/src/main/java/net/shibboleth/shared/spring/httpclient/factory/FileCachingHttpClientFactoryBean.java
index 99dad8ed..c8a1f1d0 100644
--- a/shib-networking-spring/src/main/java/net/shibboleth/shared/spring/httpclient/factory/FileCachingHttpClientFactoryBean.java
+++ b/shib-networking-spring/src/main/java/net/shibboleth/shared/spring/httpclient/factory/FileCachingHttpClientFactoryBean.java
@@ -21,9 +21,11 @@ import org.apache.hc.client5.http.classic.HttpClient;
 import org.springframework.beans.factory.DisposableBean;
 import org.springframework.beans.factory.FactoryBean;
 
+import net.shibboleth.shared.annotation.OnTeardown;
 import net.shibboleth.shared.component.DestructableComponent;
 import net.shibboleth.shared.component.InitializableComponent;
 import net.shibboleth.shared.httpclient.FileCachingHttpClientBuilder;
+import net.shibboleth.shared.primitive.AnnotationsSupport;
 
 /**
  * Factory bean version of {@link FileCachingHttpClientBuilder}.
@@ -49,10 +51,12 @@ public class FileCachingHttpClientFactoryBean extends FileCachingHttpClientBuild
     }
     
     /** {@inheritDoc} */
+    @OnTeardown
     public void destroy() {
         if (singletonInstance instanceof DestructableComponent c) {
             c.destroy();
         }
+        AnnotationsSupport.callOnTeardownAnnotations(singletonInstance);
     }
 
     /** {@inheritDoc} */
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/factory/AbstractComponentAwareFactoryBean.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/factory/AbstractComponentAwareFactoryBean.java
index b8e4b7c1..a1643e55 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/factory/AbstractComponentAwareFactoryBean.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/factory/AbstractComponentAwareFactoryBean.java
@@ -21,6 +21,7 @@ import org.springframework.beans.factory.config.AbstractFactoryBean;
 
 import net.shibboleth.shared.component.DestructableComponent;
 import net.shibboleth.shared.component.InitializableComponent;
+import net.shibboleth.shared.primitive.AnnotationsSupport;
 import net.shibboleth.shared.primitive.LoggerFactory;
 
 /**
@@ -50,6 +51,7 @@ public abstract class AbstractComponentAwareFactoryBean<T> extends AbstractFacto
         if (instance instanceof DestructableComponent dc) {
             dc.destroy();
         }
+        AnnotationsSupport.callOnTeardownAnnotations(instance);
     }
     
     /**

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list