Catch Spring events in Vaadin views

It looks like Vaadin views are registered as inner prototypes in Spring context so not reachable for event multicasting … Is there some way to catch Spring event in a view component?

Not at the moment, see https://github.com/vaadin/spring/issues/272 for more details

This example is using application events

Is this safe to use? Like the information/ event is not exposed to the wrong UIs? I remember old problems with this concept in Vaadin 8 with the event bus concept that was distributed in the past and abonded cause of this

How do you mean that? Events are pub/sub. So all listeners will get the event

Yeah that’s why I was hesitant, most of the time people wanna send / listen on event but only in the scope of their user… like they have created something and wanna inform other parts of (only this) UI about this change and not all other users. If it’s fine to have a “public” pub/sub relationship, this is totally legit… just wanted to make sure it’s mentioned because this took a lot of people by surprise in the past (therefore the old event bus was abonded)

Ah I see!

But the original question was about multicast

But definitely a good thing to keep in mind, especially WRT security/authentication context

If you trigger the event in one session and consume it in another, and the events are handled synchronously, the consumer will run as the user of the original session

See Event Pitfalls (and How to Avoid Them) - DEV Community