我正在使用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.