Spring 3.0 defines a SimpleThreadScope. Looking at all known implementing classes of the Scope interface, I see: AbstractRequestAttributesScope, PortletContextScope, RequestScope, ServletContextScope, SessionScope, SimpleThreadScope.
The first observation is that I don’t see a PrototypeScope, and don’t understand why.
My question, though, is how to use SimpleThreadScope, since RequestScope becomes “request” in XML or annotation, so I tried to use “simplethread” and “simpleThread”, but they don’t work.
I get the following message:
Caused by: java.lang.IllegalStateException: No Scope registered for scope 'simpleThread'
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)
Does it mean that SimpleThreadScope should be used only programmatically, not through XML or annotations? And how to use it?
SimpleThreadScopeis not registered by default, so that you need to register it manually in order to use it, see 3.5.5.2 Using a custom scope.singletonandprototypescopes don’t have theirScopeclasses since they are hardcoded into bean factory.