gateway 报 WebFluxSecurityConfiguration.class] and overriding is disabled.

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的模块引入了

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

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

        <dependency>
            <groupId>com.zmc</groupId>
            <artifactId>common</artifactId>
            <version>1.0-SNAPSHOT</version>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-web</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

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

  <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
        </dependency>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值