gateway如何引入common模块
来源:4-9 详解项目中增加网关模块

weixin_慕丝3459798
2023-12-15
直接引入common模块启动项目报错
Description:
Spring MVC found on classpath, which is incompatible with Spring Cloud Gateway.
Action:
Please set spring.main.web-application-type=reactive or remove spring-boot-starter-web dependency.
- 尝试设置spring.main.web-application-type=reactive, 会要求我配置数据库 报错如下
Description:
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
Reason: Failed to determine a suitable driver class
2.排除common包下的springweb依赖
写法如下
<dependency>
<groupId>com.mooc</groupId>
<artifactId>common</artifactId>
<exclusions>
<!-- Spring Cloud Gateway 项目中不能使用 spring-boot-starter-web 依赖-->
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</exclusion>
</exclusions>
</dependency>
报错
gateway依赖如下
写回答
1回答
-
甲蛙
2023-12-18
gateway不需要引入common模块,我课程里也没引入
022023-12-20
相似问题