This is regarding migration of a simple websphere flowers application to Spring MVC.
The shopping cart which is spring bean is session scoped. and is being injected into the Shopping cart controller.
The context file looks like below
When deployed, i get error
Error Stack Trace:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'shopping': Scope 'session' is not ac
tive for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton; nested excep
tion is java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual we
b request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and s
till receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestConte
xtListener or RequestContextFilter to expose the current request.
so googled a bit, sought suggestion from peers....
it seems there's clash of session scoped bean being injected in Singleton scoped controller.
so the solution is include the following i.e <aop:scoped-proxy/> in the context xml file.
You are of course correct, I reread my response and said 'have to' instead of 'could' I should know better than to type in absolutes With Spring there is usually several ways to solve the same problem. I guess i just got over excited for an opportunity to promote java config