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?
SimpleThreadScope
is 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.
singleton
and prototype
scopes don't have their Scope
classes since they are hardcoded into bean factory.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With