今天在做springboot整合成springCloud并注册到consul中时,发现若注册到consule中成功 则不能启动swagger,且不能提供任何API服务,要是能提供API服务则不能注册到consule中,并报错“


  1. Spring MVC found on classpath, which is incompatible with Spring Cloud Gateway at this time. "+
  2. "Please remove spring-boot-starter-web dependency

分析了一下,发现在如下代码中会报这个log信息


  1. @Configuration
  2. @AutoConfigureBefore(GatewayAutoConfiguration.class)
  3. public class GatewayClassPathWarningAutoConfiguration {
  4. private static final Log log = LogFactory.getLog(GatewayClassPathWarningAutoConfiguration.class);
  5. private static final String BORDER = "\n\n**********************************************************\n\n";
  6. @Configuration
  7. @ConditionalOnClass(name = "org.springframework.web.servlet.DispatcherServlet")
  8. protected static class SpringMvcFoundOnClasspathConfiguration {
  9. public SpringMvcFoundOnClasspathConfiguration() {
  10. log.warn(BORDER+"Spring MVC found on classpath, which is incompatible with Spring Cloud Gateway at this time. "+
  11. "Please remove spring-boot-starter-web dependency."+BORDER);
  12. }
  13. }
  14. @Configuration
  15. @ConditionalOnMissingClass("org.springframework.web.reactive.DispatcherHandler")
  16. protected static class WebfluxMissingFromClasspathConfiguration {
  17. public WebfluxMissingFromClasspathConfiguration() {
  18. log.warn(BORDER+"Spring Webflux is missing from the classpath, which is required for Spring Cloud Gateway at this time. "+
  19. "Please add spring-boot-starter-webflux dependency."+BORDER);
  20. }
  21. }
  22. }

最终,我们分析是swagger启动时所要的jar包和springCloud有所冲突,修改我们的POM文件如下,主要是版本的问题:

发现consul 1.2版本需要和SpringCloud的Finchley版本才能整合


  1. <parent>
  2. <groupId>org.springframework.boot</groupId>
  3. <artifactId>spring-boot-starter-parent</artifactId>
  4. <version>2.0.3.RELEASE</version>
  5. <relativePath/> <!-- lookup parent from repository -->
  6. </parent>
  7. <dependencyManagement>
  8. <dependencies>
  9. <dependency>
  10. <groupId>org.springframework.cloud</groupId>
  11. <artifactId>spring-cloud-dependencies</artifactId>
  12. <version>Finchley.RELEASE</version>
  13. <type>pom</type>
  14. <scope>import</scope>
  15. </dependency>
  16. </dependencies>
  17. </dependencyManagement>

原文地址:https://blog.csdn.net/qq116165600/article/details/90640451

springboot注册到consul中报错:Spring MVC found on classpath, which is incompatible with Spring Cloud的更多相关文章

  1. Springboot打包放到Tomcat中报错 One or more listener fail to start

    1.问题: Springboot项目直接启动不报错,打war包放到外部容器Tomcat.东方通上,在@Weblistener注解的监听器类中报错 One or more listener fail t ...

  2. 基于注解Spring MVC综合Hibernate(需要jar包,spring和Hibernate整合配置,springMVC组态,重定向,)批量删除

    1.进口jar 2.web.xml配置 <?xml version="1.0" encoding="UTF-8"?> <web-app ver ...

  3. Spring MVC教程——检视阅读

    Spring MVC教程--检视阅读 参考 Spring MVC教程--一点--蓝本 Spring MVC教程--c语言中午网--3.0版本太老了 Spring MVC教程--易百--4.0版本不是通 ...

  4. Spring MVC Maven 环境搭建与部署

    本文简单演示了本地开发环境的搭建.项目出包.部署运行.HelloWorld,以及部分注意事项. 起初的玩法:先安装Eclipse,然后分别下载并安装Maven.spring的插件,再进行工程模式转换, ...

  5. Spring MVC 教程,快速入门,深入分析

    http://elf8848.iteye.com/blog/875830/ Spring MVC 教程,快速入门,深入分析 博客分类: SPRING Spring MVC 教程快速入门  资源下载: ...

  6. Spring MVC 教程

    目录  一.前言二.spring mvc 核心类与接口三.spring mvc 核心流程图 四.spring mvc DispatcherServlet说明 五.spring mvc 父子上下文的说明 ...

  7. (转)Spring MVC

    资源下载: Spring_MVC_教程_快速入门_深入分析V1.1.pdf SpringMVC核心配置文件示例.rar 作者:赵磊 博客:http://elf8848.iteye.com 目录 一.前 ...

  8. Spring MVC 教程,快速入门,深入分析(转载)

    作者:赵磊 博客:http://elf8848.iteye.com 下载: Spring的官方下载网址是:http://www.springsource.org/download    (本文使用是的 ...

  9. 深入理解Spring MVC 思想

    目录  一.前言二.spring mvc 核心类与接口三.spring mvc 核心流程图 四.spring mvc DispatcherServlet说明 五.spring mvc 父子上下文的说明 ...

随机推荐

  1. C++ atof 函数

    腾讯云:https://cloud.tencent.com/developer/article/1391966 atof函数: 功能:将字串转换成浮点型数 相关函数 atoi,atol,strtod, ...

  2. ogr ogr2ogr 矢量数据格式转换 ogrinfo 矢量数据图层信息操作 ogr gdal的一部分 gdal 命令行 库操作

  3. gpload导入常见问题汇总

    gpload导入常见问题汇总 java写文件后使用gpload命令导入greenplum: 问题一: 报错信息:invalid byte sequence for encoding "UTF ...

  4. leetcode 293.Flip Game(lintcode 914) 、294.Flip Game II(lintcode 913)

    914. Flip Game https://www.cnblogs.com/grandyang/p/5224896.html 从前到后遍历,遇到连续两个'+',就将两个加号变成'-'组成新的字符串加 ...

  5. 【439】Tweets processing by Python

        参数说明: coordinates:Represents the geographic location of this Tweet as reported by the user or cl ...

  6. PAT 甲级 1070 Mooncake (25 分)(结构体排序,贪心,简单)

    1070 Mooncake (25 分)   Mooncake is a Chinese bakery product traditionally eaten during the Mid-Autum ...

  7. Swift编码总结2

    1.swift如何隐藏在 iPad 上的 quicktype 键盘工具栏? let item = textField.inputAssistantItem item.leadingBarButtonG ...

  8. hdu 2018 母牛的故事 动态规划入门题

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2018 设 f[i][j] 表示第i天年龄为j的母牛个数,其中j=4代表所有年龄达到4岁的成年母牛,则: ...

  9. lodop和c-lodop通过打印状态和任务不在队列获取打印成功

    之前的博文有通过判断pirnt的返回值,判断加入队列算打印成功,建议使用这种简单的判断方法.此外还有其他判断方法,例如通过PRINT_STATUS_OK判断,但是这个状态不是所有打印机能支持这种判断成 ...

  10. JS根据offsetHeight修改元素的高度

    之前的博文: 测试了offsetHeight获取的是页面元素的高度,包裹该元素本身内容的高度,上下padding,上下border.这个获取的但是px,px是相对单位,受电脑分辨率的影响,用LODOP ...