Skip to content

AnnotationTypeFilter not finding java.lang annotations as meta annotations [SPR-12633] #17234

Closed
@spring-projects-issues

Description

@spring-projects-issues

John Bass opened SPR-12633 and commented

After upgraded from Spring 4.0.2.RELEASE to 4.1.4.RELEASE, I noticed that the AnnotationTypeFilter class is no longer able to find meta annotations. Here's a snippet:

public @interface MetaAnnotation {
}

 @MetaAnnotation
public @interface CustomAnnotation {
}

@CustomAnnotation
public class TestBean {
}

@Test
public void metaAnnotationNotWorking() throws Exception {
	AnnotationTypeFilter typeFilter = new AnnotationTypeFilter( MetaAnnotation.class, true );
	ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider( false );
	provider.addIncludeFilter( typeFilter );
	Set<BeanDefinition> candidates = provider.findCandidateComponents( TestBean.class.getPackage().getName() );
	assert !candidates.isEmpty();
}

Affects: 4.1.4

Issue Links:

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 apply

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions