java - Accessing Spring Session scoped Proxy Beans -
i'm developing web-app using struts 2 spring 3 backend. i'm using spring aop:proxy beans handle session beans rather struts 2 sessionaware interface. working fine until have action running under struts execandwait interceptor. because interceptor in effect runs action under seperate thread, when come try , access proxied session bean, beancreationexception/illegalstateexception. there "spring way" can hold of session beans in scenario?
regards
from execute , wait interceptor documentation
important: because action running in seperate thread, can't use actioncontext because threadlocal. means if need access, example, session data, need implement sessionaware rather calling actioncontext.getsession().
the problem session scoped-beans depend on thread-local attributes set requestcontextlistener or requestcontextfilter. latter allows set interesting threadcontextinheritable flag...
if execandwait interceptor creates new thread per every request serves, inheritable thread local should propagate session scoped beans child threads. if struts uses thread pool (more likely, thou haven't used struts2 ages) serve requests, have unexpected , dangerous results. might experiment flag, maybe trick.
Comments
Post a Comment