0

In application context when i have

    <beans:bean id="Facade"
      class="com.facade.Facade"/> 

every thing works fine i can access facade using SpringUtil.getBean("Facade")

but if i add session = scope i.e

<beans:bean id="Facade"
      class="com.facade.Facade" scope="session"/>

i get the below error.... How to fix it ? I am using zk + spring security

     [java] Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'F
acade': Scope 'session' is not active for the current thread; consider defining a scoped proxy for this bean if you inte
nd to refer to it from a singleton; nested exception is java.lang.IllegalStateException: No thread-bound request found:
Are you referring to request attributes outside of an actual web request? If you are actually operating within a web req
uest and still receive this message,your code is probably running outside of DispatcherServlet/DispatcherPortlet: In thi
s case, use RequestContextListener or RequestContextFilter to expose the current request.
4

1 回答 1

0

您的评论对于解决方案确实是正确的。但是为什么你希望一个门面在会话范围内呢?

换句话说,您将为您拥有的每个会话一次又一次地创建此 bean。因此,如果有 5 个用户登录,您就有 5 个相同类的 bean。
这仍然是通缉的情况吗?

问候寒意。

于 2014-01-13T14:38:49.000 回答