Access UI from Spring (BEAN no View) Component

Hello
I wanted to ask a question about how to access from a Spring component (BEAN) to the UI of the application.
For example, I have a class with some method with @Scheduled and I want that when it takes 10 seconds to update the UI.

The best approach is that you have coherent MVC / MVP pattern in your application. In this approach you do not need to call / access UI from background processes directly. Instead you should implement the View so, that it has methods that can update itself. In View you have getUI() method, which returns reference to right UI when View is attached. So let say, if your View has method updateMySelf(), your presenter or controller class can call it, and View will update accordingly. This approach lets you use threadpool (e.g. in case of Spring @Scheduled, and @Async). UI.getCurrent() returns null when called from background thread.

Thank!!!
I know you tell me… but i “want” to do like i write… My solution had been pass the UI by parameter… and works!!!
Thank you, your approach is nice :slight_smile:

Sorry for my poor english
Edu