Cześć!
Mam ogromy problem z którym już dłuższy czas poradzić sobie nie mogę.
Otóz posiadam beana:
@Component("messageListener")
public class MessageListener implements Serializable, ApplicationListener<MessageEvent>
{
...
@Autowired
@Qualifier("debtsController")
private IDebtsControllerRefresher debtsController;
...
który posiada wyżej wymienioną zależność od beana debtController:
@Component("debtsController")
@Scope(value="session", proxyMode=ScopedProxyMode.INTERFACES)
public class DebtsController implements IDebtsControllerRefresher, IDebtsControllerJobStarter, IDebtsControllerDetailProvider
...
oczywiście wpis do kontekstu:
<context:component-scan base-package="com.gw.groupwallet.settlement" scoped-proxy="interfaces" />
oraz w web.xml
<listener>
<listener-class>
org.springframework.web.context.request.RequestContextListener
</listener-class>
</listener>
<filter>
<filter-name>requestContextFilter</filter-name>
<filter-class>org.springframework.web.filter.RequestContextFilter</filter-class>
</filter>
i co ciekawe to wg dokumentacji springa i googla ma wystarczyć... a jednak ciągle otrzymuje:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.debtsController': Scope 'session' 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: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:342)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.aop.target.SimpleBeanTargetSource.getTarget(SimpleBeanTargetSource.java:33)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:182)
at $Proxy6.refreshNotFinalizedDebtsBeingCreditor(Unknown Source)
at com.gw.groupwallet.event.MessageListener.onApplicationEvent(MessageListener.java:52)
at com.gw.groupwallet.event.MessageListener.onApplicationEvent(MessageListener.java:20)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:324)
at com.gw.groupwallet.jobs.service.DebtsCheckerService.jobWasExecuted(DebtsCheckerService.java:64)
at org.quartz.core.QuartzScheduler.notifyJobListenersWasExecuted(QuartzScheduler.java:1937)
... 3 more
Caused by: java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
at org.springframework.web.context.request.RequestContextHolder.currentRequestAttributes(RequestContextHolder.java:131)
at org.springframework.web.context.request.SessionScope.get(SessionScope.java:90)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:328)
... 13 more
Błagam o jakiekolwiek wskazówki !!