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
-
Constructor Summary
ConstructorDescriptionConstruct a newAnnotationScopeMetadataResolver
.AnnotationScopeMetadataResolver
(ScopedProxyMode defaultProxyMode) Construct a newAnnotationScopeMetadataResolver
using the supplied defaultScopedProxyMode
. -
Method Summary
Modifier and TypeMethodDescriptionresolveScopeMetadata
(BeanDefinition definition) Resolve theScopeMetadata
appropriate to the supplied beandefinition
.void
setScopeAnnotationType
(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
. -
AnnotationScopeMetadataResolver
Construct a newAnnotationScopeMetadataResolver
using 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:ScopeMetadataResolver
Resolve theScopeMetadata
appropriate 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 class
of the supplieddefinition
, or to use metadata present in theAttributeAccessor.attributeNames()
of the supplieddefinition
.- Specified by:
resolveScopeMetadata
in interfaceScopeMetadataResolver
- Parameters:
definition
- the target bean definition- Returns:
- the relevant scope metadata; never
null
-