Class SimpleThreadScope
- All Implemented Interfaces:
org.springframework.beans.factory.config.Scope
Scope
implementation.
NOTE: This thread scope is not registered by default in common contexts.
Instead, you need to explicitly assign it to a scope key in your setup, either through
ConfigurableBeanFactory.registerScope(java.lang.String, org.springframework.beans.factory.config.Scope)
or through a CustomScopeConfigurer
bean.
SimpleThreadScope
does not clean up any objects associated with it.
It is therefore typically preferable to use a request-bound scope implementation such
as org.springframework.web.context.request.RequestScope
in web environments,
implementing the full lifecycle for scoped attributes (including reliable destruction).
For an implementation of a thread-based Scope
with support for destruction
callbacks, refer to
Spring by Example.
Thanks to Eugene Kuleshov for submitting the original prototype for a thread scope!
- Since:
- 3.0
- Author:
- Arjen Poutsma, Juergen Hoeller
- See Also:
-
org.springframework.web.context.request.RequestScope
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
registerDestructionCallback
(String name, Runnable callback)
-
Constructor Details
-
SimpleThreadScope
public SimpleThreadScope()
-
-
Method Details
-
get
- Specified by:
get
in interfaceorg.springframework.beans.factory.config.Scope
-
remove
- Specified by:
remove
in interfaceorg.springframework.beans.factory.config.Scope
-
registerDestructionCallback
- Specified by:
registerDestructionCallback
in interfaceorg.springframework.beans.factory.config.Scope
-
resolveContextualObject
- Specified by:
resolveContextualObject
in interfaceorg.springframework.beans.factory.config.Scope
-
getConversationId
- Specified by:
getConversationId
in interfaceorg.springframework.beans.factory.config.Scope
-