编程语言
首页 > 编程语言> > 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.

标签:spring-webflux,spring-boot,java,spring-mvc
来源: https://codeday.me/bug/20191211/2107026.html