How to fix BeanCreateException for a request scope bean used with Spring MVC framework
I define a bean with scope request and get an error when i start my application:
"Cannot resolve reference to bean 'accountDS' while setting bean pro开发者_StackOverflow中文版perty 'accountDS'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'accountDS': Scope 'request' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton; nested exception is java.lang.IllegalStateException: No thread-bound request found"
I am using this bean from within my controller which is a singleton. Is this why i can't get a request? If so how can i create a scoped proxy? I also have RequestContextListener in my web.xml but it doesn't help.
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
<bean id="..." class="..." scope="request">
<aop:scoped-proxy />
</bean>
精彩评论