Please set spring.main.web-application-type=reactive or remove spring-boot-starter-web dependency

目录

系列文章目录

一、项目启动报错

1、报错截图

2、错误信息

二、解决方案

1.错误原因


 

 前言

本篇博客使用Spring Cloud 2021版本、Nacos 1.4.0、Spring Boot 2.7.6、Gateway

系列文章目录

 Spring Boot2.0系列教程合集、Spring Cloud系列教程合集、Spring Boot常见错误合集、Spring Cloud常见错误合集_zjh_746140129的博客-CSDN博客


以下是本篇文章正文内容,下面案例可供参考

一、项目启动报错

1、报错截图

 

2、错误信息

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.

二、解决方案

1.错误原因

在Spring Boot整合GateWay时, GateWay组件中的 【spring-boot-starter-webflux】 和springboot作为web项目启动必不可少的 【spring-boot-starter-web】 出现冲突,网上查阅资料有建议在pom中移除一个spring-boot-starter-web,尝试了还是不行,后面通过在配置文件添加如下配置解决:

spring:

  main:
    web-application-type: reactive

 

  • 8
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值