Skip to content

Regression: Cannot import XML bean documents using classpath*: pseudo URLs [SPR-6411] #11077

@spring-projects-issues

Description

@spring-projects-issues

David Ward opened SPR-6411 and commented

At alfresco, we have a large number of spring bean files containing wildcard imports such as this

<beans>

<import resource="classpath*:alfresco/module-context.xml" />
<import resource="classpath*:alfresco/enterprise/*-context.xml"/>

</beans>

Unfortunately, this no longer works with Spring 3.0 RC2.

I have tracked down the problem to

org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(Element)

and have successfully fixed the issue in my own subclass with the following change

        // Discover whether the location is an absolute or relative URI
        boolean absoluteLocation = false;

        try
        {
            absoluteLocation = location.startsWith(ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX) // ADDED THIS LINE
                    || ResourceUtils.toURI(location).isAbsolute();
        }
        catch (Exception ex)
        {
            // cannot convert to an URI, considering the location relative
        }

Affects: 3.0 RC2

Issue Links:

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions