- A+
所属分类:SpringBoot
---
title: Spring Cloud Gateway与spring-boot-starter-web冲突
date: 2019-10-31 08:03:27
categories: Spring Cloud Gateway
tags:
- spring
- Cloud
- Gateway
- spring-boot-starter-web
- 冲突
- exclusions
---
大家应该都知道,Spring Cloud Gateway与spring-boot-starter-web有冲突,一般情况下我们只需要把spring-boot-starter-web依赖去掉即可。
但是现在的情况是,Spring Cloud Gateway工程里引入了一个common包,common包里又加了spring-boot-starter-web依赖,所以无法直接删除依赖。解决方法如下:
在引入common包里加上exclusions来去掉spring-boot-starter-web依赖。
<dependency>
<groupId>com.xxx</groupId>
<artifactId>xxx-common</artifactId>
<version>0.0.1-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</exclusion>
</exclusions>
</dependency>
