You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've got a problem with providing custom messages in different languages for bean validation using WebFlux. It does not use messages for locale I send in header.
I think this is a bug because LocalValidatorFactoryBean uses LocaleContextMessageInterpolator. Hibernate Validator calls the public String interpolate(String message, Context context) method, which relays on the LocaleContextHolder. It uses a ThreadLocal which can't be used in WebFlux.
Hello @jakubdyszkiewicz , WebMvc works because FrameworkServlet has a method FrameworkServlet.initContextHolders to set LocaleContextHolder.setLocaleContext(...). Seems like that WebFlux doesn't have such functionallity at least I haven't found it.
As a workaround you can override a default httpHandler:
Hello,
I've got a problem with providing custom messages in different languages for bean validation using WebFlux. It does not use messages for locale I send in header.
I think this is a bug because
LocalValidatorFactoryBean
usesLocaleContextMessageInterpolator
. Hibernate Validator calls thepublic String interpolate(String message, Context context) method
, which relays on theLocaleContextHolder
. It uses aThreadLocal
which can't be used in WebFlux.I created sample repository, I hope you find it helpful
https://github.com/jakubdyszkiewicz/webflux-validation
Thanks
The text was updated successfully, but these errors were encountered: