@Scope annotations not sufficient for scanning anymore
This commit is contained in:
parent
e1a3e44485
commit
ad1269622b
|
|
@ -168,13 +168,10 @@ public class ClassPathScanningCandidateComponentProvider implements ResourceLoad
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
protected void registerDefaultFilters() {
|
protected void registerDefaultFilters() {
|
||||||
this.includeFilters.add(new AnnotationTypeFilter(Component.class));
|
this.includeFilters.add(new AnnotationTypeFilter(Component.class));
|
||||||
this.includeFilters.add(new AnnotationTypeFilter(Scope.class));
|
|
||||||
ClassLoader cl = ClassPathScanningCandidateComponentProvider.class.getClassLoader();
|
ClassLoader cl = ClassPathScanningCandidateComponentProvider.class.getClassLoader();
|
||||||
try {
|
try {
|
||||||
this.includeFilters.add(new AnnotationTypeFilter(
|
this.includeFilters.add(new AnnotationTypeFilter(
|
||||||
((Class<? extends Annotation>) cl.loadClass("javax.inject.Named"))));
|
((Class<? extends Annotation>) cl.loadClass("javax.inject.Named"))));
|
||||||
this.includeFilters.add(new AnnotationTypeFilter(
|
|
||||||
((Class<? extends Annotation>) cl.loadClass("javax.inject.Scope"))));
|
|
||||||
}
|
}
|
||||||
catch (ClassNotFoundException ex) {
|
catch (ClassNotFoundException ex) {
|
||||||
// JSR-330 API not available - simply skip.
|
// JSR-330 API not available - simply skip.
|
||||||
|
|
|
||||||
|
|
@ -366,12 +366,13 @@ public class ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@RequestScoped
|
|
||||||
@Named("request")
|
@Named("request")
|
||||||
|
@RequestScoped
|
||||||
public static class RequestScopedTestBean extends ScopedTestBean implements AnotherScopeTestInterface {
|
public static class RequestScopedTestBean extends ScopedTestBean implements AnotherScopeTestInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Named
|
||||||
@SessionScoped
|
@SessionScoped
|
||||||
public static class SessionScopedTestBean extends ScopedTestBean implements AnotherScopeTestInterface {
|
public static class SessionScopedTestBean extends ScopedTestBean implements AnotherScopeTestInterface {
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ import org.springframework.util.ClassUtils;
|
||||||
import org.springframework.web.context.request.RequestContextHolder;
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||||
import org.springframework.web.context.support.GenericWebApplicationContext;
|
import org.springframework.web.context.support.GenericWebApplicationContext;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Mark Fisher
|
* @author Mark Fisher
|
||||||
|
|
@ -318,6 +319,7 @@ public class ClassPathBeanDefinitionScannerScopeIntegrationTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Component
|
||||||
@Scope("singleton")
|
@Scope("singleton")
|
||||||
public static class SingletonScopedTestBean extends ScopedTestBean {
|
public static class SingletonScopedTestBean extends ScopedTestBean {
|
||||||
}
|
}
|
||||||
|
|
@ -327,11 +329,13 @@ public class ClassPathBeanDefinitionScannerScopeIntegrationTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Component
|
||||||
@Scope("request")
|
@Scope("request")
|
||||||
public static class RequestScopedTestBean extends ScopedTestBean implements AnotherScopeTestInterface {
|
public static class RequestScopedTestBean extends ScopedTestBean implements AnotherScopeTestInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Component
|
||||||
@Scope("session")
|
@Scope("session")
|
||||||
public static class SessionScopedTestBean extends ScopedTestBean implements AnotherScopeTestInterface {
|
public static class SessionScopedTestBean extends ScopedTestBean implements AnotherScopeTestInterface {
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue