From f7b6f34ddc2515ff7dba24cbb4ac4184c12bef93 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Mon, 14 Dec 2009 00:53:56 +0000 Subject: [PATCH] support @ManagedBean for name retrieval in AnnotationBeanNameGenerator as well; support @ManagedBean and @Named for direct use only git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@2647 50f2f4bb-b051-0410-bef5-90022cba6387 --- .../context/annotation/AnnotationBeanNameGenerator.java | 1 + .../ClassPathScanningCandidateComponentProvider.java | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/org.springframework.context/src/main/java/org/springframework/context/annotation/AnnotationBeanNameGenerator.java b/org.springframework.context/src/main/java/org/springframework/context/annotation/AnnotationBeanNameGenerator.java index 70c45036f05..a490c8ca2fa 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/annotation/AnnotationBeanNameGenerator.java +++ b/org.springframework.context/src/main/java/org/springframework/context/annotation/AnnotationBeanNameGenerator.java @@ -111,6 +111,7 @@ public class AnnotationBeanNameGenerator implements BeanNameGenerator { boolean isStereotype = annotationType.equals(COMPONENT_ANNOTATION_CLASSNAME) || (metaAnnotationTypes != null && metaAnnotationTypes.contains(COMPONENT_ANNOTATION_CLASSNAME)) || + annotationType.equals("javax.annotation.ManagedBean") || annotationType.equals("javax.inject.Named"); return (isStereotype && attributes != null && attributes.containsKey("value")); } diff --git a/org.springframework.context/src/main/java/org/springframework/context/annotation/ClassPathScanningCandidateComponentProvider.java b/org.springframework.context/src/main/java/org/springframework/context/annotation/ClassPathScanningCandidateComponentProvider.java index e9f47c639e5..380994a2fb8 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/annotation/ClassPathScanningCandidateComponentProvider.java +++ b/org.springframework.context/src/main/java/org/springframework/context/annotation/ClassPathScanningCandidateComponentProvider.java @@ -171,7 +171,7 @@ public class ClassPathScanningCandidateComponentProvider implements ResourceLoad ClassLoader cl = ClassPathScanningCandidateComponentProvider.class.getClassLoader(); try { this.includeFilters.add(new AnnotationTypeFilter( - ((Class) cl.loadClass("javax.annotation.ManagedBean")))); + ((Class) cl.loadClass("javax.annotation.ManagedBean")), false)); logger.info("JSR-250 'javax.annotation.ManagedBean' found and supported for component scanning"); } catch (ClassNotFoundException ex) { @@ -179,7 +179,7 @@ public class ClassPathScanningCandidateComponentProvider implements ResourceLoad } try { this.includeFilters.add(new AnnotationTypeFilter( - ((Class) cl.loadClass("javax.inject.Named")))); + ((Class) cl.loadClass("javax.inject.Named")), false)); logger.info("JSR-330 'javax.inject.Named' annotation found and supported for component scanning"); } catch (ClassNotFoundException ex) {