java-带@EnableWebFlux批注的SpringWebFlux错误

前端之家收集整理的这篇文章主要介绍了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

enabling MVC and WebFlux in the same application context which triggers a conflict

you can’t have them in the same process currently.

它提供了使用反应式存储库的解决方法

However,you can use reactive repositories from your existing Spring MVC application,and return the reactive types (Flux or Mono),from Spring MVC controller methods.

原文链接:https://www.f2er.com/java/532799.html

猜你在找的Java相关文章