Skip to content

@ComponentScan with includeFilters on @Import-ed context does not work [SPR-9031] #13670

@spring-projects-issues

Description

@spring-projects-issues

Michael Donaghy opened SPR-9031 and commented

It seems that using @ComponentScan with an includeFilters set only works for top-level contexts, not for @Imported contexts? See the attached minimal example maven project: the LowLevelContext works correctly, but the HighLevelContext does not, even though all the HighLevelContext does is to @Import the LowLevelContext.

Stepping through in a debugger I found that different AnnotationMetadata implementations are passed to ConfigurationClassParser#doProcessConfigurationClass in the two cases:
For LowLevelContext a StandardAnnotationMetadata is used (and behaves correctly).
For HighLevelContext an AnnotationMetadataReadingVisitor is used, and seems to return an empty array from getAnnotationAttributes(ComponentScan.class.getName()).get("includeFilters"), which is incorrect.


Affects: 3.1 GA

Attachments:

Issue Links:

Referenced from: commits spring-attic/spring-framework-issues@dd79a1b

Metadata

Metadata

Assignees

No one assigned

    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