Sto utilizzando JSF 2 per la vista e Spring per la business logic. Sto cercando di impostare un ambito sessione per uno dei miei fagioli molla con annotazioni (@Scope ("sessione")), ma sto ottenendo questa eccezione:Utilizzo di Session Scope in Spring Beans
SEVERE: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'handleFiles': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private creazione.util.FTPOperations creazione.components.HandleOldFiles.operations;
nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'ftpOperations': 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.
so di RequestContextListener. È nel mio web.xml. Ho anche aggiunto RequestContextFilter:
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<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>
<filter-mapping>
<filter-name>requestContextFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>INCLUDE</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
Niente sembra funzionare. Che cosa sto facendo di sbagliato? Grazie!
Sì, ma io sto usando le annotazioni. Ho un sacco di fagioli primaverili da scrivere in applicationContext.xml. Esiste un'annotazione equivalente con ? –
spauny
prova a guardare questa domanda http://stackoverflow.com/questions/4503606/annotation-equivalent-of-aopscoped-proxy – stivlo
Ancora non funziona ... Ho aggiunto @Scope (value = "session" , proxyMode = ScopedProxyMode.INTERFACES), ho refactored un'interfaccia per ogni bean spring, ma ora AutoWiring non riconosce più i miei bean ... – spauny