今天在做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. HttpLitener处理http请求和Websocket请求

    HttpLitener处理http请求和Websocket请求的案例具体步骤如下 1.新建控制台项目TestClientWebsocket 2.选择项目右键添加类HttpAndWebsocket,代码 ...

  2. 深拷贝(deep clone)与浅拷贝(shallow clone)

    一.浅复制和深复制概念 浅复制(浅克隆): 被复制对象的所有变量都含有与原来对象相同的值,而所有的对其他对象的引用仍然指向原来的对象.换言之,浅复制仅仅复制所考虑的对象,而不是复制它所引用的对象. 深 ...

  3. Apache-dbutils 简介及事务处理

    一:commons-dbutils简介 commons-dbutils 是 Apache 组织提供的一个开源 JDBC工具类库,它是对JDBC的简单封装,学习成本极低,并且使用dbutils能极大简化 ...

  4. XSS平台-学习

    单点登录 - Telnet 404https://sso.telnet404.com/cas/login?service=https%3A%2F%2Fwww.seebug.org%2Faccounts ...

  5. 目标检测标注工具labelImg安装及使用

    目标检测中,原始图片的标注过程是非常重要的,它的作用是在原始图像中标注目标物体位置并对每张图片生成相应的xml文件表示目标标准框的位置.本文介绍一款使用方便且能够标注多类别并能直接生成xml文件的标注 ...

  6. 阿里云配置WAF的步骤

    date:2019-07-04  17:59:19 author: headsen chen 配置WAF防护策略 本页目录 操作步骤 网站接入Web应用防火墙(WAF)后,WAF以默认防护策略为其过滤 ...

  7. ISO/IEC 9899:2011 条款6.9——外部定义

    6.9 外部定义 语法 1.translation-unit: external-declaration translation-unit    external-declaration extern ...

  8. error C2061: 语法错误: 标识符“openmode”

    今天在一台新机子上编译项目,出现了这个错误,不知如何解决,先记录一下. 1>------ 已启动全部重新生成: 项目: ZERO_CHECK, 配置: Debug x64 ------1> ...

  9. NDK开发和NDK双进程守护

    https://www.jianshu.com/p/433b2c93c6a7 NDK进程守护 https://blog.csdn.net/k393393/article/details/7895435 ...

  10. 【k8s label】对node添加删除label,并根据label筛选节点

    添加 kubectl label nodes kube-node label_name=label_value kubectl label nodes 1.1.1.1 label_name=label ...