Class AnnotationScopeMetadataResolver
- java.lang.Object
- org.springframework.context.annotation.AnnotationScopeMetadataResolver
- All Implemented Interfaces:
ScopeMetadataResolver
public class AnnotationScopeMetadataResolver extends Object implements ScopeMetadataResolver
AScopeMetadataResolverimplementation that by default checks for the presence of Spring's@Scopeannotation on the bean class.The exact type of annotation that is checked for is configurable via
setScopeAnnotationType(Class).- Since:
- 2.5
- Author:
- Mark Fisher, Juergen Hoeller, Sam Brannen
- See Also:
Scope
Field Summary
Fields Modifier and Type Field Description protected Class<? extends Annotation>scopeAnnotationType
Constructor Summary
Constructors Constructor Description AnnotationScopeMetadataResolver()Construct a newAnnotationScopeMetadataResolver.AnnotationScopeMetadataResolver(ScopedProxyMode defaultProxyMode)Construct a newAnnotationScopeMetadataResolverusing the supplied defaultScopedProxyMode.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ScopeMetadataresolveScopeMetadata(BeanDefinition definition)Resolve theScopeMetadataappropriate to the supplied beandefinition.voidsetScopeAnnotationType(Class<? extends Annotation> scopeAnnotationType)Set the type of annotation that is checked for by thisAnnotationScopeMetadataResolver.
Field Detail
scopeAnnotationType
protected Class<? extends Annotation> scopeAnnotationType
Constructor Detail
AnnotationScopeMetadataResolver
public AnnotationScopeMetadataResolver()
Construct a newAnnotationScopeMetadataResolver.
AnnotationScopeMetadataResolver
public AnnotationScopeMetadataResolver(ScopedProxyMode defaultProxyMode)
Construct a newAnnotationScopeMetadataResolverusing the supplied defaultScopedProxyMode.- Parameters:
defaultProxyMode- the default scoped-proxy mode
Method Detail
setScopeAnnotationType
public void setScopeAnnotationType(Class<? extends Annotation> scopeAnnotationType)
Set the type of annotation that is checked for by thisAnnotationScopeMetadataResolver.- Parameters:
scopeAnnotationType- the target annotation type
resolveScopeMetadata
public ScopeMetadata resolveScopeMetadata(BeanDefinition definition)
Description copied from interface:ScopeMetadataResolverResolve theScopeMetadataappropriate to the supplied beandefinition.Implementations can of course use any strategy they like to determine the scope metadata, but some implementations that spring immediately to mind might be to use source level annotations present on
the classof the supplieddefinition, or to use metadata present in theAttributeAccessor.attributeNames()of the supplieddefinition.- Specified by:
resolveScopeMetadatain interfaceScopeMetadataResolver- Parameters:
definition- the target bean definition- Returns:
- the relevant scope metadata; never
null