The Spring event mechanism supports publishing application events and listening to these events within Spring components via the @EventListener
annotation. However, I cannot find anything about sending events within a specific scope in the documentation. My specific need for Vaadin is:
- in context of a user interaction, send an event (e.g. logged-in event)
- this event should only be consumed by beans in same
@UIScope
, i.e. other user UIs shouldn't be effected
Is that possible? NOTE: This is not really specific to Vaadin. I could also ask how it would be done with Spring web mvc request scope.
@PreDestroy
method already called when you asynchronously process the data. – Bulldozevaadin-ui
would be notified. – Forgerycondition
attribute of the@EventListener
annotation (see here for some details). You can basically define a condition in SpEL that needs to be met for the listener to be invoked. – MagnaApplicationEventPublisher
ui-scoped though. But I'm not sure that the UI-scoped listener registration is a good trade-off for preventing too many listeners from performing a single check. – Agouti