Preserve 'reader' attribute in @ImportResource hierarchies [SPR-6327] #10993
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
status: declined
A suggestion or change that we don't feel we should currently apply
type: enhancement
A general enhancement
Chris Beams opened SPR-6327 and commented
Status Quo
Currently, either of the following work fine:
However, the following will not work:
Analysis
Problem: the XML file specified in
ConfigA
will be read by thePropertiesBeanDefinitionReader
declared inConfigB
, which naturally fails.Cause: when parsing annotations from the
@Configuration
class hierarchy, the lastreader
attribute wins, effectively overriding any otherreader
attributes from classes up the hierarchy.Solution: crawl the class/annotation hierarchy manually and build up a context containing every resource and its associated
BeanDefinitionReader
type, analogous to the support forloader
in@ContextConfiguration
in the Spring TestContext Framework (TCF).This is similar in concept to the way that TCF operates. In this way, this improvement will make sense to implement alongside #10976, which deals with support for relative paths and import-by-convention semantics -- features that are also supported by TCF.
Issue Links:
@Configuration
class hierarchies@ImportResource
Referenced from: commits ae11387
The text was updated successfully, but these errors were encountered: