Class AnnotationScopeMetadataResolver
java.lang.Object
org.springframework.context.annotation.AnnotationScopeMetadataResolver
- All Implemented Interfaces:
ScopeMetadataResolver
A
ScopeMetadataResolver implementation that by default checks for
the presence of Spring's @Scope annotation 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:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstruct a newAnnotationScopeMetadataResolver.AnnotationScopeMetadataResolver(ScopedProxyMode defaultProxyMode) Construct a newAnnotationScopeMetadataResolverusing the supplied defaultScopedProxyMode. -
Method Summary
Modifier and TypeMethodDescriptionresolveScopeMetadata(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 Details
-
scopeAnnotationType
-
-
Constructor Details
-
AnnotationScopeMetadataResolver
public AnnotationScopeMetadataResolver()Construct a newAnnotationScopeMetadataResolver.- See Also:
-
AnnotationScopeMetadataResolver
Construct a newAnnotationScopeMetadataResolverusing the supplied defaultScopedProxyMode.- Parameters:
defaultProxyMode- the default scoped-proxy mode
-
-
Method Details
-
setScopeAnnotationType
Set the type of annotation that is checked for by thisAnnotationScopeMetadataResolver.- Parameters:
scopeAnnotationType- the target annotation type
-
resolveScopeMetadata
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
-