The bean 'requestMappingHandlerAdapter', defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class], could not be registered. A bean with that name has already been defined in class path resource [org/springframework/web/reactive/config/DelegatingWebFluxConfiguration.class] and overriding is disabled.

由于我的common的模块引入了

org.springframework.boot

spring-boot-starter-web

网关中的 spring-boot-starter-webflux 包含了spring-web 的依赖,所以 目前我在资源服务器中使用了 SecurityWebFilterChain (spring-web下的一个配置类)类,建议在引入common模块(或其他包含spring-web、spring-boot-starter-web模块)排除掉,如下:

com.zmc

common

1.0-SNAPSHOT

org.springframework.boot

spring-boot-starter-web

排除后,common模块又开始报错了,因为我在common模块中引入了servlet相关的东西,如: javax.servlet.ServletRequest 但在网关中引入是排除了spring-boot-start-web , 可以引入这一块相关的jar依赖解决(其实可以直接删除spring-start-web依赖,只要引用的东西不多,可以引入细粒度的jar就行)

javax.servlet

javax.servlet-api

好文链接

评论可见,请评论后查看内容,谢谢!!!
 您阅读本篇文章共花了: