Consider @Import classes as lite @Configuration

Allow classes that are annotated with @Import to be considered as 'lite'
@Configuration candidates. Allows the AnnotationConfigApplicationContext
to directly register @Import beans even if they are not @Components.

Issue: SPR-10533
This commit is contained in:
Phillip Webb
2013-05-02 09:41:20 -07:00
parent d91ffb6a59
commit 71f6da673a
2 changed files with 24 additions and 3 deletions

View File

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