public class SimpleThreadScope
extends java.lang.Object
implements 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.
As such, it is typically preferable to use
RequestScope
in web environments.
For an implementation of a thread-based Scope
with support for
destruction callbacks, refer to the
Spring by Example Custom Thread Scope Module.
Thanks to Eugene Kuleshov for submitting the original prototype for a thread scope!
org.springframework.web.context.request.RequestScope
Constructor and Description |
---|
SimpleThreadScope() |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
get(java.lang.String name,
org.springframework.beans.factory.ObjectFactory<?> objectFactory) |
java.lang.String |
getConversationId() |
void |
registerDestructionCallback(java.lang.String name,
java.lang.Runnable callback) |
java.lang.Object |
remove(java.lang.String name) |
java.lang.Object |
resolveContextualObject(java.lang.String key) |
public java.lang.Object get(java.lang.String name, org.springframework.beans.factory.ObjectFactory<?> objectFactory)
get
in interface org.springframework.beans.factory.config.Scope
public java.lang.Object remove(java.lang.String name)
remove
in interface org.springframework.beans.factory.config.Scope
public void registerDestructionCallback(java.lang.String name, java.lang.Runnable callback)
registerDestructionCallback
in interface org.springframework.beans.factory.config.Scope
public java.lang.Object resolveContextualObject(java.lang.String key)
resolveContextualObject
in interface org.springframework.beans.factory.config.Scope
public java.lang.String getConversationId()
getConversationId
in interface org.springframework.beans.factory.config.Scope