I am using Spring Boot and Vaadin Flow (latest). And I tried the broadcaster example and it works. But as soon as I try to pass the received message to a @SessionScope annotated bean, I am getting an exception
java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request
Any hints on this? Thanks in advance for your time!
Here's what's happening according to my understanding: Spring's
@SessionScopebeans are created for each HTTP Session, or as the documentation says,This means you need to be working in the context of an HTTP session, and as the error message says,
The example implementation of the Broadcaster pattern uses a simple background thread executor created by the
Executors.newSingleThreadExecutor()- the thread doesn't know anything about HTTP requests or sessions, and it's specifically notrunning in the context of a web-aware Spring ApplicationContext..Your actual problem isn't visible in the question, but hopefully, this answer clarifies the error you're getting and helps you move forward.