ScopeMetadataResolver implementation that follows JSR-330 scoping rules:
defaulting to prototype scope unless jakarta.inject.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.
registerScope, resolveScopeName, ClassPathBeanDefinitionScanner#setScopeMetadataResolver, AnnotatedBeanDefinitionReader#setScopeMetadataResolver
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public final void | registerScope(Class<?>
the JSR-330 annotation type as a Class annotationType, String the Spring scope name scopeName)Register an extended JSR-330 scope annotation, mapping it onto a specific Spring scope by name. |
| public final void | registerScope(String
the JSR-330 annotation type by name annotationType, String the Spring scope name scopeName)Register an extended JSR-330 scope annotation, mapping it onto a specific Spring scope by name. |
| public ScopeMetadata | resolveScopeMetadata(BeanDefinition
the target bean definition definition)Implements org. ScopeMetadata appropriate to the supplied
bean definition.
|
| protected String | Returns: the Spring scope namethe JSR-330 annotation type annotationType)Resolve the given annotation type into a named Spring scope. |
| scopeMap | back to summary |
|---|---|
| private final Map<String, String> scopeMap | |
| Jsr330ScopeMetadataResolver | back to summary |
|---|---|
| public Jsr330ScopeMetadataResolver() | |
| registerScope | back to summary |
|---|---|
| public final void registerScope(Class<?> annotationType, String scopeName) Register an extended JSR-330 scope annotation, mapping it onto a specific Spring scope by name. | |
| registerScope | back to summary |
|---|---|
| public final void registerScope(String annotationType, String scopeName) Register an extended JSR-330 scope annotation, mapping it onto a specific Spring scope by name. | |
| resolveScopeMetadata | back to summary |
|---|---|
| public ScopeMetadata resolveScopeMetadata(BeanDefinition definition) Implements org. Doc from org. Resolve the 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
| |
| resolveScopeName | back to summary |
|---|---|
| protected String resolveScopeName(String annotationType) Resolve the given annotation type into a named Spring scope. The default implementation simply checks against registered scopes. Can be overridden for custom mapping rules, e.g. naming conventions. | |