public class SimpleThreadScope extends 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.
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!
org.springframework.web.context.request.RequestScope| 构造器和说明 |
|---|
SimpleThreadScope() |
public Object get(String name, org.springframework.beans.factory.ObjectFactory<?> objectFactory)
get 在接口中 org.springframework.beans.factory.config.Scope@Nullable public Object remove(String name)
remove 在接口中 org.springframework.beans.factory.config.Scopepublic void registerDestructionCallback(String name, Runnable callback)
registerDestructionCallback 在接口中 org.springframework.beans.factory.config.Scope@Nullable public Object resolveContextualObject(String key)
resolveContextualObject 在接口中 org.springframework.beans.factory.config.Scopepublic String getConversationId()
getConversationId 在接口中 org.springframework.beans.factory.config.Scope