Vaadin scopes problems

In my application I need to use spring beans.

I annotated my bean with @VaadinSessionScope or @UIScope and I get the following error :

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: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
	at org.springframework.web.context.request.RequestContextHolder.currentRequestAttributes(RequestContextHolder.java:131)
	at axioma.rubik.engine.vaadin.contesto.ConnessioniSession.getSessionId(ConnessioniSession.java:10)
	at axioma.rubik.contesto.Connessioni.init(Connessioni.java:24)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363)
	at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:307)
	at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136)

Anotating it with @Scope(“session”) I get a different error (Session is not active).

What’s wrong ?

Tks

Where you are autowiring the @VaadinSessionScope bean? It should be a @Route or @Scope(“prototype”) bound to a @Route. I do not get this exception on my test application. I suspect that you are trying to autowire to a non-request context.

I’m autowiring in another bean as usual with Spring.
The bean is in the request context.
The Spring integration with Vaadin 8 was straightforeward : normal Spring bean integration.
With Vaadin 14 is not clear, for me, where and how beans can be found.
If I create @Scope(“session”) bean they do not work at all.
Retriving bean from the context often fails.
I still don’t understand if @Route are beans or not.
I’m confused and documentation doesn’t clarify dependency between Spring and Vaadin.
Tks for any help.
Tullio