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 b2bb113ad78..51974b4a801 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 @@ -168,13 +168,10 @@ public class ClassPathScanningCandidateComponentProvider implements ResourceLoad @SuppressWarnings("unchecked") protected void registerDefaultFilters() { this.includeFilters.add(new AnnotationTypeFilter(Component.class)); - this.includeFilters.add(new AnnotationTypeFilter(Scope.class)); ClassLoader cl = ClassPathScanningCandidateComponentProvider.class.getClassLoader(); try { this.includeFilters.add(new AnnotationTypeFilter( ((Class) cl.loadClass("javax.inject.Named")))); - this.includeFilters.add(new AnnotationTypeFilter( - ((Class) cl.loadClass("javax.inject.Scope")))); } catch (ClassNotFoundException ex) { // JSR-330 API not available - simply skip. diff --git a/org.springframework.integration-tests/src/test/java/org/springframework/context/annotation/jsr330/ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests.java b/org.springframework.integration-tests/src/test/java/org/springframework/context/annotation/jsr330/ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests.java index 705229cedf3..c1d74a88d26 100644 --- a/org.springframework.integration-tests/src/test/java/org/springframework/context/annotation/jsr330/ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests.java +++ b/org.springframework.integration-tests/src/test/java/org/springframework/context/annotation/jsr330/ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests.java @@ -366,12 +366,13 @@ public class ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests { } - @RequestScoped @Named("request") + @RequestScoped public static class RequestScopedTestBean extends ScopedTestBean implements AnotherScopeTestInterface { } + @Named @SessionScoped public static class SessionScopedTestBean extends ScopedTestBean implements AnotherScopeTestInterface { } diff --git a/org.springframework.integration-tests/src/test/java/org/springframework/context/annotation/scope/ClassPathBeanDefinitionScannerScopeIntegrationTests.java b/org.springframework.integration-tests/src/test/java/org/springframework/context/annotation/scope/ClassPathBeanDefinitionScannerScopeIntegrationTests.java index 8b48e58da82..0ddec41ffad 100644 --- a/org.springframework.integration-tests/src/test/java/org/springframework/context/annotation/scope/ClassPathBeanDefinitionScannerScopeIntegrationTests.java +++ b/org.springframework.integration-tests/src/test/java/org/springframework/context/annotation/scope/ClassPathBeanDefinitionScannerScopeIntegrationTests.java @@ -36,6 +36,7 @@ import org.springframework.util.ClassUtils; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; import org.springframework.web.context.support.GenericWebApplicationContext; +import org.springframework.stereotype.Component; /** * @author Mark Fisher @@ -318,6 +319,7 @@ public class ClassPathBeanDefinitionScannerScopeIntegrationTests { } + @Component @Scope("singleton") public static class SingletonScopedTestBean extends ScopedTestBean { } @@ -327,11 +329,13 @@ public class ClassPathBeanDefinitionScannerScopeIntegrationTests { } + @Component @Scope("request") public static class RequestScopedTestBean extends ScopedTestBean implements AnotherScopeTestInterface { } + @Component @Scope("session") public static class SessionScopedTestBean extends ScopedTestBean implements AnotherScopeTestInterface { }