diff --git a/org.springframework.beans/src/main/java/org/springframework/beans/factory/xml/DefaultBeanDefinitionDocumentReader.java b/org.springframework.beans/src/main/java/org/springframework/beans/factory/xml/DefaultBeanDefinitionDocumentReader.java index 8e50e81007..aa5ccc0ec2 100644 --- a/org.springframework.beans/src/main/java/org/springframework/beans/factory/xml/DefaultBeanDefinitionDocumentReader.java +++ b/org.springframework.beans/src/main/java/org/springframework/beans/factory/xml/DefaultBeanDefinitionDocumentReader.java @@ -22,19 +22,18 @@ import java.util.Set; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - import org.springframework.beans.factory.BeanDefinitionStoreException; import org.springframework.beans.factory.config.BeanDefinitionHolder; import org.springframework.beans.factory.parsing.BeanComponentDefinition; import org.springframework.beans.factory.support.BeanDefinitionReaderUtils; import org.springframework.core.io.Resource; -import org.springframework.core.io.support.ResourcePatternUtils; +import org.springframework.util.ResourceUtils; import org.springframework.util.StringUtils; import org.springframework.util.SystemPropertyUtils; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; /** * Default implementation of the {@link BeanDefinitionDocumentReader} interface. @@ -168,7 +167,18 @@ public class DefaultBeanDefinitionDocumentReader implements BeanDefinitionDocume location = SystemPropertyUtils.resolvePlaceholders(location); Set actualResources = new LinkedHashSet(4); - if (ResourcePatternUtils.isUrl(location)) { + + // Discover whether the location is an absolute or relative URI + boolean absoluteLocation = false; + + try { + absoluteLocation = ResourceUtils.toURI(location).isAbsolute(); + } catch (Exception ex) { + // cannot convert to an URI, considering the location relative + } + + // check the + if (absoluteLocation) { try { int importCount = getReaderContext().getReader().loadBeanDefinitions(location, actualResources); if (logger.isDebugEnabled()) {