public class

AnnotationScopeMetadataResolver

extends Object
implements ScopeMetadataResolver
java.lang.Object
   ↳ org.springframework.context.annotation.AnnotationScopeMetadataResolver

Class Overview

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 the setScopeAnnotationType(Class) property.

See Also

Summary

Fields
protected Class<? extends Annotation> scopeAnnotationType
Public Constructors
AnnotationScopeMetadataResolver()
Create a new instance of the AnnotationScopeMetadataResolver class.
AnnotationScopeMetadataResolver(ScopedProxyMode defaultProxyMode)
Create a new instance of the AnnotationScopeMetadataResolver class.
Public Methods
ScopeMetadata resolveScopeMetadata(BeanDefinition definition)
Resolve the ScopeMetadata appropriate to the supplied bean definition.
void setScopeAnnotationType(Class<? extends Annotation> scopeAnnotationType)
Set the type of annotation that is checked for by this AnnotationScopeMetadataResolver.
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.springframework.context.annotation.ScopeMetadataResolver

Fields

protected Class<? extends Annotation> scopeAnnotationType

Public Constructors

public AnnotationScopeMetadataResolver ()

Create a new instance of the AnnotationScopeMetadataResolver class.

public AnnotationScopeMetadataResolver (ScopedProxyMode defaultProxyMode)

Create a new instance of the AnnotationScopeMetadataResolver class.

Parameters
defaultProxyMode the desired scoped-proxy mode

Public Methods

public ScopeMetadata resolveScopeMetadata (BeanDefinition definition)

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 attributeNames() of the supplied definition.

Parameters
definition the target bean definition
Returns
  • the relevant scope metadata; never null

public void setScopeAnnotationType (Class<? extends Annotation> scopeAnnotationType)

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

Parameters
scopeAnnotationType the target annotation type