[spring-extensions] branch master updated: IDP-1642 - Migrate configuration into jars where feasible

Scott Cantor cantor.2 at osu.edu
Mon Aug 3 20:38:27 UTC 2020


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

scantor pushed a commit to branch master
in repository spring-extensions.

View the commit online:
http://git.shibboleth.net/view/?p=spring-extensions.git;a=commit;h=2e7b12cc6fce2c909dd297c808c57862e0c68a75

The following commit(s) were added to refs/heads/master by this push:
       new  2e7b12c   IDP-1642 - Migrate configuration into jars where feasible
2e7b12c is described below

commit 2e7b12cc6fce2c909dd297c808c57862e0c68a75
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Mon Aug 3 16:39:09 2020 -0400

    IDP-1642 - Migrate configuration into jars where feasible
    
    https://issues.shibboleth.net/jira/browse/IDP-1642
    
    Replace bean definition reader in the root context.
---
 .../context/DelimiterAwareApplicationContext.java  | 35 +++++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)

diff --git a/src/main/java/net/shibboleth/ext/spring/context/DelimiterAwareApplicationContext.java b/src/main/java/net/shibboleth/ext/spring/context/DelimiterAwareApplicationContext.java
index 1c341ff..7ffe442 100644
--- a/src/main/java/net/shibboleth/ext/spring/context/DelimiterAwareApplicationContext.java
+++ b/src/main/java/net/shibboleth/ext/spring/context/DelimiterAwareApplicationContext.java
@@ -17,10 +17,18 @@
 
 package net.shibboleth.ext.spring.context;
 
+import java.io.IOException;
+
 import javax.annotation.Nonnull;
 
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
+import org.springframework.beans.factory.xml.ResourceEntityResolver;
+import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
 import org.springframework.util.StringUtils;
 
+import net.shibboleth.ext.spring.util.SchemaTypeAwareXMLBeanDefinitionReader;
+
 /**
  * Version of {@link DeferPlaceholderFileSystemXmlWebApplicationContext} which does not necessarily assume that file
  * list are space separated.
@@ -40,4 +48,29 @@ public class DelimiterAwareApplicationContext extends DeferPlaceholderFileSystem
     @Nonnull protected String getDelimiters() {
         return ",;\t\n";
     }
-}
+
+    /**
+     * {@inheritDoc}
+     * 
+     * The override is necessary to replace the bean definition reader with a non-broken version that honors
+     * the context's ResourceLoader instead of supplanting it.
+     */
+    @Override
+    protected void loadBeanDefinitions(final DefaultListableBeanFactory beanFactory)
+            throws BeansException, IOException {
+        // Create a new XmlBeanDefinitionReader for the given BeanFactory.
+        final XmlBeanDefinitionReader beanDefinitionReader = new SchemaTypeAwareXMLBeanDefinitionReader(beanFactory);
+
+        // Configure the bean definition reader with this context's
+        // resource loading environment.
+        beanDefinitionReader.setEnvironment(getEnvironment());
+        beanDefinitionReader.setResourceLoader(this);
+        beanDefinitionReader.setEntityResolver(new ResourceEntityResolver(this));
+
+        // Allow a subclass to provide custom initialization of the reader,
+        // then proceed with actually loading the bean definitions.
+        initBeanDefinitionReader(beanDefinitionReader);
+        loadBeanDefinitions(beanDefinitionReader);
+    }
+
+}
\ No newline at end of file

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


More information about the commits mailing list