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 aa5ccc0ec2d..a7f35c93987 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
@@ -27,6 +27,7 @@ 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;
@@ -172,9 +173,10 @@ public class DefaultBeanDefinitionDocumentReader implements BeanDefinitionDocume
boolean absoluteLocation = false;
try {
- absoluteLocation = ResourceUtils.toURI(location).isAbsolute();
+ absoluteLocation = ResourcePatternUtils.isUrl(location) || ResourceUtils.toURI(location).isAbsolute();
} catch (Exception ex) {
// cannot convert to an URI, considering the location relative
+ // unless it is the well-known Spring prefix classpath*:
}
// check the
diff --git a/org.springframework.beans/src/test/java/org/springframework/beans/factory/xml/XmlBeanDefinitionReaderTests.java b/org.springframework.beans/src/test/java/org/springframework/beans/factory/xml/XmlBeanDefinitionReaderTests.java
index ca4090771c6..8af531ca8f9 100644
--- a/org.springframework.beans/src/test/java/org/springframework/beans/factory/xml/XmlBeanDefinitionReaderTests.java
+++ b/org.springframework.beans/src/test/java/org/springframework/beans/factory/xml/XmlBeanDefinitionReaderTests.java
@@ -82,6 +82,20 @@ public class XmlBeanDefinitionReaderTests extends TestCase {
testBeanDefinitions(registry);
}
+ public void testWithImport() {
+ SimpleBeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();;
+ Resource resource = new ClassPathResource("import.xml", getClass());
+ new XmlBeanDefinitionReader(registry).loadBeanDefinitions(resource);
+ testBeanDefinitions(registry);
+ }
+
+ public void testWithWildcardImport() {
+ SimpleBeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();;
+ Resource resource = new ClassPathResource("importPattern.xml", getClass());
+ new XmlBeanDefinitionReader(registry).loadBeanDefinitions(resource);
+ testBeanDefinitions(registry);
+ }
+
public void testWithInputSource() {
try {
SimpleBeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();;
diff --git a/org.springframework.beans/src/test/resources/org/springframework/beans/factory/xml/import.xml b/org.springframework.beans/src/test/resources/org/springframework/beans/factory/xml/import.xml
new file mode 100644
index 00000000000..278e5dff811
--- /dev/null
+++ b/org.springframework.beans/src/test/resources/org/springframework/beans/factory/xml/import.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/org.springframework.beans/src/test/resources/org/springframework/beans/factory/xml/importPattern.xml b/org.springframework.beans/src/test/resources/org/springframework/beans/factory/xml/importPattern.xml
new file mode 100644
index 00000000000..085a29d85fd
--- /dev/null
+++ b/org.springframework.beans/src/test/resources/org/springframework/beans/factory/xml/importPattern.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+