Top Description Fields Constructors Methods
org.springframework.context.annotation

public Class AnnotationScopeMetadataResolver

extends Object
implements ScopeMetadataResolver
Class Inheritance
All Implemented Interfaces
org.springframework.context.annotation.ScopeMetadataResolver
Imports
java.lang.annotation.Annotation, org.springframework.beans.factory.annotation.AnnotatedBeanDefinition, org.springframework.beans.factory.config.BeanDefinition, org.springframework.core.annotation.AnnotationAttributes, org.springframework.util.Assert

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).

Authors
Mark Fisher, Juergen Hoeller, Sam Brannen
Since
2.5
See Also
org.springframework.context.annotation.Scope

Field Summary

Modifier and TypeField and Description
private final ScopedProxyMode
protected Class<? extends Annotation>

Constructor Summary

AccessConstructor and Description
public
AnnotationScopeMetadataResolver()

Construct a new AnnotationScopeMetadataResolver.

public
AnnotationScopeMetadataResolver(ScopedProxyMode
the default scoped-proxy mode
defaultProxyMode
)

Construct a new AnnotationScopeMetadataResolver using the supplied default ScopedProxyMode.

Method Summary

Modifier and TypeMethod and Description
public ScopeMetadata
resolveScopeMetadata(BeanDefinition
the target bean definition
definition
)

Implements org.springframework.context.annotation.ScopeMetadataResolver.resolveScopeMetadata.

Resolve the ScopeMetadata appropriate to the supplied bean definition.

public void
setScopeAnnotationType(Class<? extends Annotation>
the target annotation type
scopeAnnotationType
)

Set the type of annotation that is checked for by this AnnotationScopeMetadataResolver.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

defaultProxyModeback to summary
private final ScopedProxyMode defaultProxyMode
scopeAnnotationTypeback to summary
protected Class<? extends Annotation> scopeAnnotationType

Constructor Detail

AnnotationScopeMetadataResolverback to summary
public AnnotationScopeMetadataResolver()

Construct a new AnnotationScopeMetadataResolver.

See Also
AnnotationScopeMetadataResolver(ScopedProxyMode), ScopedProxyMode#NO
AnnotationScopeMetadataResolverback to summary
public AnnotationScopeMetadataResolver(ScopedProxyMode defaultProxyMode)

Construct a new AnnotationScopeMetadataResolver using the supplied default ScopedProxyMode.

Parameters
defaultProxyMode:ScopedProxyMode

the default scoped-proxy mode

Method Detail

resolveScopeMetadataback to summary
public ScopeMetadata resolveScopeMetadata(BeanDefinition definition)

Implements org.springframework.context.annotation.ScopeMetadataResolver.resolveScopeMetadata.

Doc from org.springframework.context.annotation.ScopeMetadataResolver.resolveScopeMetadata.

Resolve the ScopeMetadata appropriate to the supplied bean definition.

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 supplied definition, or to use metadata present in the BeanDefinition#attributeNames() of the supplied definition.

Parameters
definition:BeanDefinition

the target bean definition

Returns:ScopeMetadata

the relevant scope metadata; never null

Annotations
@Override
setScopeAnnotationTypeback to summary
public void setScopeAnnotationType(Class<? extends Annotation> scopeAnnotationType)

Set the type of annotation that is checked for by this AnnotationScopeMetadataResolver.

Parameters
scopeAnnotationType:Class<? extends Annotation>

the target annotation type