Class Jsr330ScopeMetadataResolver
- All Implemented Interfaces:
- ScopeMetadataResolver
ScopeMetadataResolver implementation that follows JSR-330 scoping rules:
defaulting to prototype scope unless Singleton is present.
This scope resolver can be used with ClassPathBeanDefinitionScanner and
AnnotatedBeanDefinitionReader for standard JSR-330 compliance. However,
in practice, you will typically use Spring's rich default scoping instead - or extend
this resolver with custom scoping annotations that point to extended Spring scopes.
- Since:
- 3.0
- Author:
- Juergen Hoeller
- See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionfinal voidregisterScope(Class<?> annotationType, String scopeName) Register an extended JSR-330 scope annotation, mapping it onto a specific Spring scope by name.final voidregisterScope(String annotationType, String scopeName) Register an extended JSR-330 scope annotation, mapping it onto a specific Spring scope by name.resolveScopeMetadata(BeanDefinition definition) Resolve theScopeMetadataappropriate to the supplied beandefinition.resolveScopeName(String annotationType) Resolve the given annotation type into a named Spring scope.
- 
Constructor Details- 
Jsr330ScopeMetadataResolverpublic Jsr330ScopeMetadataResolver()
 
- 
- 
Method Details- 
registerScope
- 
registerScope
- 
resolveScopeNameResolve the given annotation type into a named Spring scope.The default implementation simply checks against registered scopes. Can be overridden for custom mapping rules, for example, naming conventions. - Parameters:
- annotationType- the JSR-330 annotation type
- Returns:
- the Spring scope name
 
- 
resolveScopeMetadataDescription 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 interface- ScopeMetadataResolver
- Parameters:
- definition- the target bean definition
- Returns:
- the relevant scope metadata; never null
 
 
-