[spring-extensions] branch maint-6 updated: JSE-51 - Wildcard classpath imports don't work in our import logic

Scott Cantor cantor.2 at osu.edu
Fri Nov 18 14:39:29 UTC 2022


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

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

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

The following commit(s) were added to refs/heads/maint-6 by this push:
     new 0b9b1a0  JSE-51 - Wildcard classpath imports don't work in our import logic
0b9b1a0 is described below

commit 0b9b1a07a6b09b217f14bb7cdbd38f3ba4d55df5
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Fri Nov 18 09:39:23 2022 -0500

    JSE-51 - Wildcard classpath imports don't work in our import logic
    
    https://shibboleth.atlassian.net/browse/JSE-51
---
 .../util/SchemaTypeAwareBeanDefinitionDocumentReader.java     | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/main/java/net/shibboleth/ext/spring/util/SchemaTypeAwareBeanDefinitionDocumentReader.java b/src/main/java/net/shibboleth/ext/spring/util/SchemaTypeAwareBeanDefinitionDocumentReader.java
index f0164c4..ab0f224 100644
--- a/src/main/java/net/shibboleth/ext/spring/util/SchemaTypeAwareBeanDefinitionDocumentReader.java
+++ b/src/main/java/net/shibboleth/ext/spring/util/SchemaTypeAwareBeanDefinitionDocumentReader.java
@@ -25,6 +25,7 @@ import org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader
 import org.springframework.beans.factory.xml.XmlReaderContext;
 import org.springframework.core.io.Resource;
 import org.springframework.core.io.ResourceLoader;
+import org.springframework.core.io.support.ResourcePatternResolver;
 import org.springframework.util.StringUtils;
 import org.w3c.dom.Element;
 
@@ -43,6 +44,9 @@ public class SchemaTypeAwareBeanDefinitionDocumentReader extends DefaultBeanDefi
      * 
      * This override prevents the default behavior from kicking in if the original resource location
      * is directly usable by the installed {@link ResourceLoader}.
+     * 
+     * <p>This is needed because Spring's internal behavior around imports unfortunately ignores the
+     * whole ResourceLoader hook. Arguably a bug.</p>
      */
     @Override
     protected void importBeanDefinitionResource(final Element ele) {
@@ -55,6 +59,13 @@ public class SchemaTypeAwareBeanDefinitionDocumentReader extends DefaultBeanDefi
         // Resolve system properties: e.g. "${user.dir}"
         location = getReaderContext().getEnvironment().resolveRequiredPlaceholders(location);
 
+        // Check for wildcard syntax we don't handle, JSE-51.
+        if (location.startsWith(ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX)) {
+            logger.debug("Wildcard classpath syntax, delegating to default behavior");
+            super.importBeanDefinitionResource(ele);
+            return;
+        }
+        
         final Set<Resource> actualResources = new LinkedHashSet<>(4);
 
         final Resource r = getReaderContext().getResourceLoader().getResource(location);

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


More information about the commits mailing list