今天在做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. 方法重载与invokevirtual字节码指令的关系

    1.方法重载 创建MyTest5类 public class MyTest5 { public void test(Grandpa grandpa){ System.out.println(" ...

  2. QEMU支持的网络模式

    网络是现代计算机系统不可或缺的一部分,QEMU也对虚拟机提供丰富的网络支持.qemu-kvm中主要给客户机提供了如下4种不同模式的网络. (1)基于网桥(Bridge)的虚拟网卡 (2)基于NAT(N ...

  3. 高性能计算 —— 中国金融服务业创新发展的助推剂 & 微软

    “高性能计算 —— 中国金融服务业创新发展的助推剂“六大盘点 - 微软 - 博客园https://www.cnblogs.com/stbchina/archive/2011/12/02/HPC-in- ...

  4. 在mac中安装tmux

    在mac 中安装Tmux: 在终端输入如下命令: brew  install tmux Tmux 的快捷键前缀(Prefix) 为了使自身的快捷键和其他软件的快捷键互不干扰,Tmux 提供了一个快捷键 ...

  5. MySQL there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause同时创建多个更新当前时间戳字段 解决方法

    问题重现 在写这篇文章之前,明确我的MySQL版本,MariaDB 或者你使用 MySQL 8 也会出现如下问题 MySQL 版本 现在有这样的需求,一张表中有一个字段created_at记录创建该条 ...

  6. openresty开发系列11--openresty的api入门

    openresty开发系列11--openresty的api入门 1)ngx_lua模块的hello world编辑nginx下conf配置文件nginx.conf# vi nginx.conf在se ...

  7. Python3基础 complex 声明复数

             Python : 3.7.3          OS : Ubuntu 18.04.2 LTS         IDE : pycharm-community-2019.1.3    ...

  8. 我非要捅穿这 Neutron(二)上层资源模型篇

    目录 文章目录 目录 Neutron 的资源模型 Network 运营商网络和租户网络 创建运营商网络 创建租户网络 创建外部网络 Network 小结 Subnet IP 核心网络服务 Subnet ...

  9. Spring5源码分析之AnnotationConfigApplicationContext

    前言: 主要了解的内容有如下几点: @Qualifier与@Primary注解的使用 Spring中ApplicationContext的作用 BeanFactory与ApplicationConte ...

  10. Spring cloud微服务安全实战-5-2前端页面改造

    创建一个新的maveb项目,做一个admin的管理界面 用angular写前面的页面. 先吧dependcency引用引进来. 前端的插件能帮我在springboot里面搭建出一个nodeJS的环境来 ...