Closed
Description
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
:
- 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.
- 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:
- Support @ImportResource within @Configuration classes [SPR-6158] #10826 Support
@ImportResource
within@Configuration
classes ("depends on") - Relative imports in @Configuration classes [SPR-8356] #13003 Relative imports in
@Configuration
classes - Preserve 'reader' attribute in @ImportResource hierarchies [SPR-6327] #10993 Preserve 'reader' attribute in
@ImportResource
hierarchies
Referenced from: commits ae11387
1 votes, 3 watchers