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