spring-boot-starter-webflux不能使用AcceptHeaderLocaleResolver [英] spring-boot-starter-webflux can't use AcceptHeaderLocaleResolver
问题描述
spring-boot-starter-webflux不能使用org.springframework.web.servlet.i18n.AcceptHeaderLocaleResolver
那么spring-boot-starter-webflux如何使用resolveLocale?换句话说,反应堆中有什么与resolveLocale类似的东西?
Spring WebFlux默认配置和使用 org.springframework.web.server.i18n.LocaleContextResolver
(使用 org.springframework.web.server.i18n.AcceptHeaderLocaleContextResolver
和 org.springframework.web.server.i18n.FixedLocaleContextResolver
作为实现).>
您可以注入 java.util.Locale
作为Controller参数(如果使用的是Spring WebFlux的注释变体),或者注入并使用配置的 LocaleContextResolver
> bean并直接使用.
spring-boot-starter-webflux can not use org.springframework.web.servlet.i18n.AcceptHeaderLocaleResolver
so how can spring-boot-starter-webflux use resolveLocale?In other words, what is there in reactor that is similar to resolveLocale?
Spring WebFlux is configuring and using by default a org.springframework.web.server.i18n. LocaleContextResolver
(with org.springframework.web.server.i18n.AcceptHeaderLocaleContextResolver
and org.springframework.web.server.i18n.FixedLocaleContextResolver
as implementations).
You can inject the java.util.Locale
as a Controller argument (if you're using the annotation variant of Spring WebFlux), or inject and use the configured LocaleContextResolver
bean and use it directly.
这篇关于spring-boot-starter-webflux不能使用AcceptHeaderLocaleResolver的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!