Scoped beans in Spring 2.0
Recently, we built a swing based applet communicating to server side services using Spring Http remoting.
While working on remote communication, we had a need to persist some data in user http session. HttpInvoker by default is stateless.
After doing some research, we figured out new concept of Scoped beans in Spring 2.0. Till now, spring beans could either be singleton or prototype. With the introduction of scoped beans, beans can be sourced from any arbitrary storage. "Session" and "Request" based sourcing is provided out of the box for typical web applications which may like to persist some data in Http Session.
Configuration will look like:
Here "scope" attribute can take values - singleton, prototype, session, request or globalSession.
globalSession scope is applicable for Portlets.
While working on remote communication, we had a need to persist some data in user http session. HttpInvoker by default is stateless.
After doing some research, we figured out new concept of Scoped beans in Spring 2.0. Till now, spring beans could either be singleton or prototype. With the introduction of scoped beans, beans can be sourced from any arbitrary storage. "Session" and "Request" based sourcing is provided out of the box for typical web applications which may like to persist some data in Http Session.
Configuration will look like:
<bean id="helloWorld" class="com.test.hello.spring.HelloWorld"
scope="session">
<aop:scoped-proxy/>
</bean>
Here "scope" attribute can take values - singleton, prototype, session, request or globalSession.
globalSession scope is applicable for Portlets.