Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Click Listener Thread?
String lang1= LocaleContextHolder.getLocale().getLanguage();
button.addClickListener(e -> {
String lang2= LocaleContextHolder.getLocale().getLanguage();
My project uses spring boot and a SessionLocaleResolver to store the current locale in a session. Spring uses a threadlocal variable. This is why I have to get the locale from the session when my Vaadin component initializes. In the code above lang1 holds the correct locale, but lang2 has a different (mabe default) value. Why is that? Is there a special click listener thread? Is there a way to initialize the locale for that thread?
Thanks,
Roland
I think I can answer my own question. Vaadin uses a thread pool.
When I initialize or refresh my component I call VaadinSession.getCurrent().setLocale() and within the Vaadin component I should use VaadinSession.getCurrent().getLocale() instead of the Spring function