Spring Boot requestDataValueProcessor Bean 定义冲突

Posted

技术标签:

【中文标题】Spring Boot requestDataValueProcessor Bean 定义冲突【英文标题】:Spring Boot requestDataValueProcessor Bean Definition Conflict 【发布时间】:2019-08-10 17:30:37 【问题描述】:

我尝试在我的项目中使用SpringWebFluxSecurity,但是在编译时出现了这个错误

The bean 'requestDataValueProcessor', defined in class path resource [org/springframework/security/config/annotation/web/configuration/WebMvcSecurityConfiguration.class], could not be registered. A bean with that name has already been defined in class path resource [org/springframework/security/config/annotation/web/reactive/WebFluxSecurityConfiguration.class] and overriding is disabled.

我知道我必须删除对WebMvcSecurityConfiguration 的依赖。问题是我无法弄清楚在我的项目中调用该配置的位置。你知道如何找到它吗?

【问题讨论】:

你能在 pom.xml 中附加 spring 依赖项和你的主类吗? 我已经解决了这个问题。原来我只需要在application.yml 中指定spring.main.web-application-type。所以,我添加了这个spring.main.web-application-type: reactive 【参考方案1】:

运行 `mvn dependency:tree,您将能够看到项目的依赖树。然后试着找出哪些是这个依赖的包,去掉不需要的。

【讨论】:

以上是关于Spring Boot requestDataValueProcessor Bean 定义冲突的主要内容,如果未能解决你的问题,请参考以下文章

为啥 Spring Boot 应用程序 pom 同时需要 spring-boot-starter-parent 和 spring-boot-starter-web?

《02.Spring Boot连载:Spring Boot实战.Spring Boot核心原理剖析》

spring-boot-quartz, 依赖spring-boot-parent

spring-boot系列:初试spring-boot

Spring Boot:Spring Boot启动原理分析

Spring Boot:Spring Boot启动原理分析