SpringCloudGateway和SpringBootStarterWeb依赖冲突

本文介绍了SpringCloudGateway项目中由于spring-boot-starter-webflux和spring-boot-starter-web依赖冲突的问题,以及如何通过在pom.xml文件中排除spring-boot-starter-web依赖来解决这个问题。通过在引入父工程和gateway相关依赖时分别进行排除,可以避免这两个模块的冲突,确保项目正常运行。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

此问题出现的原因是在SpringCloudGateway中spring-boot-starter-webflux依赖与spring-boot-starter-web依赖冲突导致的。

解决方案:

移除或过滤spring-boot-starer-web依赖即可,在当前项目pom.xml中添加一下依赖。

       <!-- 在引入父工程依赖时,去除spring-boot-starter-web相关依赖->
        <dependency>
            <groupId>com.amh.gulimail</groupId>
            <artifactId>gulimail-common</artifactId>
            <version>0.0.1-SNAPSHOT</version>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-web</artifactId>
                 </exclusion>
            </exclusions>
        </dependency>


      <!-- 在引入gateway相关依赖时,去除spring-boot-starter-web相关依赖->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-gateway</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-web</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值