Hi, I'm trying out Spring MVC, and I could use some advice regarding storing session state and using it in Controllers (to customize rendered views for example).
Firstly I assumed that I'd use session scoped bean and inject it as a controller property. Id did not work out at first as container complained that controller has different scope than a session bean, and that's fair enough. The googled solution was to use following syntax:
<bean id="userSession" class="UserSessionImpl" scope="session">
<aop:scoped-proxy/>
</bean>
As I understand the '<aop:scoped-proxy/>' configures the container to actually create a single wrapper proxy that routes call to bean methods to proper session bean. This way the singelton controller bean can interact with session beans. Is this how it's suppose be done? Btw, there is no way to configure the same with annotation (without JavaConfig) is there?
Also, I have more general question, is it a good practice to use them statefull session beans with Spring MVC for purpose of, well, storing some session-valid state (shopping cart or such)? Can anyone advice on this?
Thanks, a lot
Łukasz


Reply With Quote
.

