From 859f422cbfb98c9276e96498250f8b48e6fb69c7 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Thu, 10 Dec 2009 20:40:02 +0000 Subject: [PATCH] component scanning autodetects the new EE 6 "javax.annotation.ManagedBean" stereotype --- .../ClassPathScanningCandidateComponentProvider.java | 9 +++++++++ 1 file changed, 9 insertions(+) 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 51974b4a80..e9f47c639e 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 @@ -169,9 +169,18 @@ public class ClassPathScanningCandidateComponentProvider implements ResourceLoad protected void registerDefaultFilters() { this.includeFilters.add(new AnnotationTypeFilter(Component.class)); ClassLoader cl = ClassPathScanningCandidateComponentProvider.class.getClassLoader(); + try { + this.includeFilters.add(new AnnotationTypeFilter( + ((Class) cl.loadClass("javax.annotation.ManagedBean")))); + logger.info("JSR-250 'javax.annotation.ManagedBean' found and supported for component scanning"); + } + catch (ClassNotFoundException ex) { + // JSR-250 1.1 API (as included in Java EE 6) not available - simply skip. + } try { this.includeFilters.add(new AnnotationTypeFilter( ((Class) cl.loadClass("javax.inject.Named")))); + logger.info("JSR-330 'javax.inject.Named' annotation found and supported for component scanning"); } catch (ClassNotFoundException ex) { // JSR-330 API not available - simply skip.