Fix nested @Component annotation instantiation bug

3.1 M2 introduced a regression that causes false positives during
@Configuration class candidate checks. Now performing a call to
AnnotationMetadata#isInterface in addition to checks for @Component and
@Bean annotations when determining whether a candidate is a 'lite'
configuration class. Annotations are in the end interfaces, so both
are filtered out at once.

Issue: SPR-8761
This commit is contained in:
Chris Beams
2011-11-26 08:04:39 +00:00
parent faba5941f7
commit 68f61f3b3c
2 changed files with 60 additions and 2 deletions

View File

@@ -100,8 +100,9 @@ abstract class ConfigurationClassUtils {
}
public static boolean isLiteConfigurationCandidate(AnnotationMetadata metadata) {
return metadata.isAnnotated(Component.class.getName()) ||
metadata.hasAnnotatedMethods(Bean.class.getName());
return !metadata.isInterface() && // not an interface or an annotation
(metadata.isAnnotated(Component.class.getName()) ||
metadata.hasAnnotatedMethods(Bean.class.getName()));
}