加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Java > 正文

java-带@EnableWebFlux批注的SpringWebFlux错误

发布时间:2020-12-14 19:24:57 所属栏目:Java 来源:网络整理
导读:我正在使用Spring Boot 2.1.1版本并使用@EnableWebFlux,但出现了一些错误. 错误是 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.reactive.config.DelegatingWebFluxConfiguration': I

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读