java - 带有 @EnableWebFlux 注释的 SpringWebFlux 错误
问题描述
我正在使用 spring boot 2.1.1 版本并使用@EnableWebFlux
,但出现了一些错误。
错误是
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.reactive.config.DelegatingWebFluxConfiguration': Initialization of bean failed; nested exception is java.lang.IllegalStateException: The Java/XML config for Spring MVC and Spring WebFlux cannot both be enabled, e.g. via @EnableWebMvc and @EnableWebFlux, in the same application
我该如何解决这个问题。
解决方案
您不能在Spring SPR-16609 中同时启用 Spring MVC 和 Spring WebFlux
在触发冲突的同一应用程序上下文中启用 MVC 和 WebFlux
你目前不能让它们在同一个过程中。
它提供了一种使用反应式存储库的解决方法:
但是,您可以使用现有 Spring MVC 应用程序中的响应式存储库,并从 Spring MVC 控制器方法返回响应式类型(Flux 或 Mono)。
推荐阅读
- java - Java 弹簧最大值。上传大小限制
- apache-spark - 使用 PySpark 将 Spark Dataframe 加载到 ElasticSearch
- java - 删除 recyclerView 中的所有选定项目
- javascript - 如何在角度 1 中获取所选选项的索引
- android - 将选项卡式活动中的浮动按钮链接到每个选项卡
- angularjs - 在 window.location.href 之前/期间吐司
- razor - ASP .Net Core 2.1.1 中的 Razor 类库
- python - 字符 U+ffffffc2 不在范围 [U+0000; U+10ffff]
- linux - 如何将私钥作为文本传递给 ssh?
- json - 在 json 文件中设置值(使用 karate intuit 框架)