Skip to content

Support relative and by-convention use of @ImportResource [SPR-6310] #10976

Closed
@spring-projects-issues

Description

@spring-projects-issues

Chris Beams opened SPR-6310 and commented

Much like Spring's TestContext framework and its @ContextConfiguration annotation, processing @Configuration classes should support relative paths and loading resources by convention when using @ImportXml:

  1. Relative paths:
package com.biz.app;
@Configuration
@ImportResource("Foo.xml")
public class AppConfig { ... }

It is assumed that Foo.xml resides in com.biz.app, the same package in which AppConfig is declared.

  1. Import by convention:
package com.biz.app;
@Configuration
@ImportResource
public class AppConfig { ... }

It is assumed that classpath:/com/biz/app/AppConfig-context.xml exists.

See testImportXmlWithRelativePath() and testImportXmlByConvention(), which are both currently @Ignore'd in org.springframework.context.annotation.configuration.ImportXmlTests. See also TODO in ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsFromXml()


Issue Links:

Referenced from: commits ae11387

1 votes, 3 watchers

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)status: declinedA suggestion or change that we don't feel we should currently applytype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions