[java-opensaml] 03/03: JSSH-71 Remove the impact of the DestructableComponent Interface

Codeberg noreply at shibboleth.net
Tue Jul 21 13:02:49 UTC 2026


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

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

View the commit online:
https://codeberg.org/Shibboleth/java-opensaml/commit/8c99431054c879657faf1c178680422da182e4d3

commit 8c99431054c879657faf1c178680422da182e4d3
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Tue Jul 21 14:03:20 2026 +0100

    JSSH-71 Remove the impact of the DestructableComponent Interface
    
    https://shibboleth.atlassian.net/browse/JSSH-71
    
    Stub out teardownInstance() in factory beans to stop debugging
    noise when the base class calls destroy() on the component.
---
 .../credential/AbstractCredentialFactoryBean.java      | 13 +++++++++++++
 .../AbstractBasicPKIXValidationInfoFactoryBean.java    | 13 +++++++++++++
 .../trust/ChainingSignatureTrustEngineFactoryBean.java | 13 +++++++++++++
 .../spring/trust/ChainingTrustEngineFactoryBean.java   | 17 ++++++++++++++---
 .../spring/trust/StaticExplicitKeyFactoryBean.java     | 18 +++++++++++++++---
 .../opensaml/spring/trust/StaticPKIXFactoryBean.java   | 16 ++++++++++++++--
 6 files changed, 82 insertions(+), 8 deletions(-)

diff --git a/opensaml-spring/src/main/java/org/opensaml/spring/credential/AbstractCredentialFactoryBean.java b/opensaml-spring/src/main/java/org/opensaml/spring/credential/AbstractCredentialFactoryBean.java
index d6098143b..2fbbfa116 100644
--- a/opensaml-spring/src/main/java/org/opensaml/spring/credential/AbstractCredentialFactoryBean.java
+++ b/opensaml-spring/src/main/java/org/opensaml/spring/credential/AbstractCredentialFactoryBean.java
@@ -20,12 +20,15 @@ import javax.annotation.Nullable;
 
 import org.opensaml.security.credential.Credential;
 
+import net.shibboleth.shared.primitive.AnnotationsSupport;
 import net.shibboleth.shared.spring.factory.AbstractComponentAwareFactoryBean;
 
 /**
  * A factory bean to accumulate the information pertaining to an
  * {@link org.opensaml.security.credential.AbstractCredential}.
  * @param <T> the type of credential to create.
+ *
+ * TODO: Remove the {@link #destroyInstance()} from this class in V6.
  */
 public abstract class AbstractCredentialFactoryBean<T extends Credential> extends AbstractComponentAwareFactoryBean<T> {
 
@@ -137,4 +140,14 @@ public abstract class AbstractCredentialFactoryBean<T extends Credential> extend
     public void setConfigDescription(@Nullable final String desc) {
         configDescription = desc;
     }
+
+    /**
+     * {@inheritDoc}
+     *
+     * <p>Call a destroy method if aposite.</p>
+     * <p> We do not call the parent tear down so as to avoid any deprecation logging</>
+     */
+    @Override protected void destroyInstance(@Nullable final T instance) throws Exception {
+        AnnotationsSupport.callOnTeardownAnnotations(instance);
+    }
 }
diff --git a/opensaml-spring/src/main/java/org/opensaml/spring/trust/AbstractBasicPKIXValidationInfoFactoryBean.java b/opensaml-spring/src/main/java/org/opensaml/spring/trust/AbstractBasicPKIXValidationInfoFactoryBean.java
index c92ad33b1..d8c652c65 100644
--- a/opensaml-spring/src/main/java/org/opensaml/spring/trust/AbstractBasicPKIXValidationInfoFactoryBean.java
+++ b/opensaml-spring/src/main/java/org/opensaml/spring/trust/AbstractBasicPKIXValidationInfoFactoryBean.java
@@ -23,10 +23,13 @@ import javax.annotation.Nullable;
 
 import org.opensaml.security.x509.impl.BasicPKIXValidationInformation;
 
+import net.shibboleth.shared.primitive.AnnotationsSupport;
 import net.shibboleth.shared.spring.factory.AbstractComponentAwareFactoryBean;
 
 /**
  * A factory bean to collect information to do with a {@link BasicPKIXValidationInformation}.
+ *
+ * TODO: Remove the {@link #destroyInstance()} from this class in V6.
  */
 public abstract class AbstractBasicPKIXValidationInfoFactoryBean extends
         AbstractComponentAwareFactoryBean<BasicPKIXValidationInformation> {
@@ -85,6 +88,16 @@ public abstract class AbstractBasicPKIXValidationInfoFactoryBean extends
         return new BasicPKIXValidationInformation(getCertificates(), getCRLs(), verifyDepth);
     }
 
+    /**
+     * {@inheritDoc}
+     *
+     * <p>Call a destroy method if aposite.</p>
+     * <p> We do not call the parent tear down so as to avoid any deprecation logging</>
+     */
+    @Override protected void destroyInstance(@Nullable final BasicPKIXValidationInformation instance) throws Exception {
+        AnnotationsSupport.callOnTeardownAnnotations(instance);
+    }
+
     /**
      * Get the configured certificates.
      * 
diff --git a/opensaml-spring/src/main/java/org/opensaml/spring/trust/ChainingSignatureTrustEngineFactoryBean.java b/opensaml-spring/src/main/java/org/opensaml/spring/trust/ChainingSignatureTrustEngineFactoryBean.java
index 619c2758a..87de123c2 100644
--- a/opensaml-spring/src/main/java/org/opensaml/spring/trust/ChainingSignatureTrustEngineFactoryBean.java
+++ b/opensaml-spring/src/main/java/org/opensaml/spring/trust/ChainingSignatureTrustEngineFactoryBean.java
@@ -21,6 +21,7 @@ import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
 import net.shibboleth.shared.collection.CollectionSupport;
+import net.shibboleth.shared.primitive.AnnotationsSupport;
 import net.shibboleth.shared.spring.factory.AbstractComponentAwareFactoryBean;
 
 import org.opensaml.xmlsec.signature.support.SignatureTrustEngine;
@@ -30,6 +31,8 @@ import org.opensaml.xmlsec.signature.support.impl.ChainingSignatureTrustEngine;
  * Factory bean for {@link ChainingSignatureTrustEngine}. This finesses the issue that some parsers are not supported
  * and return a bean of type object and these cannot be injected into the trust engine. This factory just filters the
  * unsupported engines out. A warning has been issued at point of parse so no further logging is required.
+ *
+ * TODO: Remove the {@link #destroyInstance()} from this class in V6.
  */
 public class ChainingSignatureTrustEngineFactoryBean extends
         AbstractComponentAwareFactoryBean<ChainingSignatureTrustEngine> {
@@ -70,4 +73,14 @@ public class ChainingSignatureTrustEngineFactoryBean extends
         return new ChainingSignatureTrustEngine(list);
     }
 
+    /**
+     * {@inheritDoc}
+    *
+    * <p>Call a destroy method if aposite.</p>
+    * <p> We do not call the parent tear down so as to avoid any deprecation logging</>
+    */
+   @Override protected void destroyInstance(@Nullable final ChainingSignatureTrustEngine instance) throws Exception {
+       AnnotationsSupport.callOnTeardownAnnotations(instance);
+   }
+
 }
\ No newline at end of file
diff --git a/opensaml-spring/src/main/java/org/opensaml/spring/trust/ChainingTrustEngineFactoryBean.java b/opensaml-spring/src/main/java/org/opensaml/spring/trust/ChainingTrustEngineFactoryBean.java
index 83f1293c8..caacd4b82 100644
--- a/opensaml-spring/src/main/java/org/opensaml/spring/trust/ChainingTrustEngineFactoryBean.java
+++ b/opensaml-spring/src/main/java/org/opensaml/spring/trust/ChainingTrustEngineFactoryBean.java
@@ -20,16 +20,19 @@ import java.util.List;
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
-import net.shibboleth.shared.collection.CollectionSupport;
-import net.shibboleth.shared.spring.factory.AbstractComponentAwareFactoryBean;
-
 import org.opensaml.security.trust.TrustEngine;
 import org.opensaml.security.trust.impl.ChainingTrustEngine;
 
+import net.shibboleth.shared.collection.CollectionSupport;
+import net.shibboleth.shared.primitive.AnnotationsSupport;
+import net.shibboleth.shared.spring.factory.AbstractComponentAwareFactoryBean;
+
 /**
  * Factory bean for {@link ChainingTrustEngine}. This finesses the issue that some parsers are not supported
  * and return a bean of type object and these cannot be injected into the trust engine. This factory just filters the
  * unsupported engines out. A warning has been issued at point of parse so no further logging is required.
+ *
+ * TODO: Remove the {@link #destroyInstance()} from this class in V6.
  */
 public class ChainingTrustEngineFactoryBean extends
         AbstractComponentAwareFactoryBean<ChainingTrustEngine<?>> {
@@ -72,4 +75,12 @@ public class ChainingTrustEngineFactoryBean extends
         return new ChainingTrustEngine(list);
     }
 
+    /**
+     * {@inheritDoc}
+     * <p> We do not call the parent tear down so as to avoid any deprecation logging.
+     * </>
+     */
+    @Override protected void destroyInstance(@Nullable final ChainingTrustEngine<?> instance) throws Exception {
+        AnnotationsSupport.callOnTeardownAnnotations(instance);
+    }
 }
\ No newline at end of file
diff --git a/opensaml-spring/src/main/java/org/opensaml/spring/trust/StaticExplicitKeyFactoryBean.java b/opensaml-spring/src/main/java/org/opensaml/spring/trust/StaticExplicitKeyFactoryBean.java
index 4de52a7e0..56d1be659 100644
--- a/opensaml-spring/src/main/java/org/opensaml/spring/trust/StaticExplicitKeyFactoryBean.java
+++ b/opensaml-spring/src/main/java/org/opensaml/spring/trust/StaticExplicitKeyFactoryBean.java
@@ -39,13 +39,16 @@ import org.slf4j.Logger;
 import org.springframework.beans.FatalBeanException;
 
 import net.shibboleth.shared.collection.CollectionSupport;
+import net.shibboleth.shared.primitive.AnnotationsSupport;
 import net.shibboleth.shared.primitive.LoggerFactory;
 import net.shibboleth.shared.resource.Resource;
 import net.shibboleth.shared.spring.factory.AbstractComponentAwareFactoryBean;
 
 /**
  * Factory bean for simple use cases involving the {@link ExplicitKeyTrustEngine} and static credentials.
- * 
+ *
+ * TODO: Remove the {@link #destroyInstance()} from this class in V6.
+ *
  * @since 3.3.0
  */
 public class StaticExplicitKeyFactoryBean extends AbstractComponentAwareFactoryBean<ExplicitKeyTrustEngine> {
@@ -133,5 +136,14 @@ public class StaticExplicitKeyFactoryBean extends AbstractComponentAwareFactoryB
     @Nonnull protected ExplicitKeyTrustEngine doCreateInstance() throws Exception {
         return new ExplicitKeyTrustEngine(new StaticCredentialResolver(getCredentials()));
     }
-    
-}
\ No newline at end of file
+
+    /**
+     * {@inheritDoc}
+     *
+     * <p>Call a destroy method if aposite.</p>
+     * <p> We do not call the parent tear down so as to avoid any deprecation logging</>
+     */
+    @Override protected void destroyInstance(@Nullable final ExplicitKeyTrustEngine instance) throws Exception {
+        AnnotationsSupport.callOnTeardownAnnotations(instance);
+    }
+}
diff --git a/opensaml-spring/src/main/java/org/opensaml/spring/trust/StaticPKIXFactoryBean.java b/opensaml-spring/src/main/java/org/opensaml/spring/trust/StaticPKIXFactoryBean.java
index 38eccbf01..6f9ac57ac 100644
--- a/opensaml-spring/src/main/java/org/opensaml/spring/trust/StaticPKIXFactoryBean.java
+++ b/opensaml-spring/src/main/java/org/opensaml/spring/trust/StaticPKIXFactoryBean.java
@@ -45,6 +45,7 @@ import org.springframework.beans.FatalBeanException;
 import net.shibboleth.shared.annotation.constraint.NotLive;
 import net.shibboleth.shared.annotation.constraint.Unmodifiable;
 import net.shibboleth.shared.collection.CollectionSupport;
+import net.shibboleth.shared.primitive.AnnotationsSupport;
 import net.shibboleth.shared.primitive.LoggerFactory;
 import net.shibboleth.shared.primitive.StringSupport;
 import net.shibboleth.shared.resource.Resource;
@@ -52,7 +53,9 @@ import net.shibboleth.shared.spring.factory.AbstractComponentAwareFactoryBean;
 
 /**
  * File system specific bean for PKIXX509CredentialTrustEngine.
- * 
+ *
+ * TODO: Remove the {@link #destroyInstance()} from this class in V6.
+ *
  * @since 3.3.0
  */
 public class StaticPKIXFactoryBean extends AbstractComponentAwareFactoryBean<PKIXX509CredentialTrustEngine> {
@@ -276,4 +279,13 @@ public class StaticPKIXFactoryBean extends AbstractComponentAwareFactoryBean<PKI
         }
     }
 
-}
\ No newline at end of file
+    /**
+     * {@inheritDoc}
+     *
+     * <p>Call a destroy method if aposite.</p>
+     * <p> We do not call the parent tear down so as to avoid any deprecation logging</>
+     */
+    @Override protected void destroyInstance(@Nullable final PKIXX509CredentialTrustEngine instance) throws Exception {
+        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