【发布时间】:2018-05-11 16:04:38
【问题描述】:
我刚开始一个基于 Spring boot 2 + Webflux 的新项目。在升级版本的 spring boot 并将spring-boot-starter-web 替换为spring-boot-starter-webflux 类,如
- WebMvcConfigurerAdapter
- 语言环境解析器
- 语言环境更改拦截器
不见了。现在如何配置 defaultLocale 和拦截器来更改语言?
【问题讨论】:
-
使用 LocaleContextResolver 检查docs.spring.io/spring/docs/current/spring-framework-reference/…。
-
能否提供WebMvcConfigurerAdapter、LocaleResolver、LocaleChangeInterceptor的内容?你是否为了你的目的扩展了这个类?
-
@virsha 再次阅读了我的问题。我没有这个实体。它们是我使用的 mvc 依赖项的一部分 webflux
-
Spring webflux 有一个用于 webflux 配置的 webflux 配置器适配器,例如。参见here,与
WebMvcConfigurerAdapter类似,您可以找到WebFluxConfigurer中提供的所有可选配置。 -
希望对您有所帮助link
标签: spring-boot thymeleaf spring-webflux