springboot注册到consul中报错:Spring MVC found on classpath, which is incompatible with Spring Cloud
今天在做springboot整合成springCloud并注册到consul中时,发现若注册到consule中成功 则不能启动swagger,且不能提供任何API服务,要是能提供API服务则不能注册到consule中,并报错“
-
Spring MVC found on classpath, which is incompatible with Spring Cloud Gateway at this time. "+
-
-
"Please remove spring-boot-starter-web dependency
”
分析了一下,发现在如下代码中会报这个log信息
-
@Configuration
-
-
@AutoConfigureBefore(GatewayAutoConfiguration.class)
-
-
public class GatewayClassPathWarningAutoConfiguration {
-
-
private static final Log log = LogFactory.getLog(GatewayClassPathWarningAutoConfiguration.class);
-
-
private static final String BORDER = "\n\n**********************************************************\n\n";
-
-
@Configuration
-
-
@ConditionalOnClass(name = "org.springframework.web.servlet.DispatcherServlet")
-
-
protected static class SpringMvcFoundOnClasspathConfiguration {
-
-
public SpringMvcFoundOnClasspathConfiguration() {
-
-
log.warn(BORDER+"Spring MVC found on classpath, which is incompatible with Spring Cloud Gateway at this time. "+
-
-
"Please remove spring-boot-starter-web dependency."+BORDER);
-
-
}
-
-
}
-
-
@Configuration
-
-
@ConditionalOnMissingClass("org.springframework.web.reactive.DispatcherHandler")
-
-
protected static class WebfluxMissingFromClasspathConfiguration {
-
-
public WebfluxMissingFromClasspathConfiguration() {
-
-
log.warn(BORDER+"Spring Webflux is missing from the classpath, which is required for Spring Cloud Gateway at this time. "+
-
-
"Please add spring-boot-starter-webflux dependency."+BORDER);
-
-
}
-
-
}
-
-
}
最终,我们分析是swagger启动时所要的jar包和springCloud有所冲突,修改我们的POM文件如下,主要是版本的问题:
发现consul 1.2版本需要和SpringCloud的Finchley版本才能整合
-
<parent>
-
<groupId>org.springframework.boot</groupId>
-
<artifactId>spring-boot-starter-parent</artifactId>
-
<version>2.0.3.RELEASE</version>
-
<relativePath/> <!-- lookup parent from repository -->
-
</parent>
-
-
-
-
-
-
<dependencyManagement>
-
<dependencies>
-
<dependency>
-
<groupId>org.springframework.cloud</groupId>
-
<artifactId>spring-cloud-dependencies</artifactId>
-
<version>Finchley.RELEASE</version>
-
<type>pom</type>
-
<scope>import</scope>
-
</dependency>
-
</dependencies>
-
</dependencyManagement>
原文地址:https://blog.csdn.net/qq116165600/article/details/90640451
springboot注册到consul中报错:Spring MVC found on classpath, which is incompatible with Spring Cloud的更多相关文章
- Springboot打包放到Tomcat中报错 One or more listener fail to start
1.问题: Springboot项目直接启动不报错,打war包放到外部容器Tomcat.东方通上,在@Weblistener注解的监听器类中报错 One or more listener fail t ...
- 基于注解Spring MVC综合Hibernate(需要jar包,spring和Hibernate整合配置,springMVC组态,重定向,)批量删除
1.进口jar 2.web.xml配置 <?xml version="1.0" encoding="UTF-8"?> <web-app ver ...
- Spring MVC教程——检视阅读
Spring MVC教程--检视阅读 参考 Spring MVC教程--一点--蓝本 Spring MVC教程--c语言中午网--3.0版本太老了 Spring MVC教程--易百--4.0版本不是通 ...
- Spring MVC Maven 环境搭建与部署
本文简单演示了本地开发环境的搭建.项目出包.部署运行.HelloWorld,以及部分注意事项. 起初的玩法:先安装Eclipse,然后分别下载并安装Maven.spring的插件,再进行工程模式转换, ...
- Spring MVC 教程,快速入门,深入分析
http://elf8848.iteye.com/blog/875830/ Spring MVC 教程,快速入门,深入分析 博客分类: SPRING Spring MVC 教程快速入门 资源下载: ...
- Spring MVC 教程
目录 一.前言二.spring mvc 核心类与接口三.spring mvc 核心流程图 四.spring mvc DispatcherServlet说明 五.spring mvc 父子上下文的说明 ...
- (转)Spring MVC
资源下载: Spring_MVC_教程_快速入门_深入分析V1.1.pdf SpringMVC核心配置文件示例.rar 作者:赵磊 博客:http://elf8848.iteye.com 目录 一.前 ...
- Spring MVC 教程,快速入门,深入分析(转载)
作者:赵磊 博客:http://elf8848.iteye.com 下载: Spring的官方下载网址是:http://www.springsource.org/download (本文使用是的 ...
- 深入理解Spring MVC 思想
目录 一.前言二.spring mvc 核心类与接口三.spring mvc 核心流程图 四.spring mvc DispatcherServlet说明 五.spring mvc 父子上下文的说明 ...
随机推荐
- oracle 删除某个用户下的所有对象
先存放好dropobj.sql 文件 然后登录需要删除的用户 删除前最好备份一下:(备份是在cmd中进行的) C:\Users\panfu>exp file=d:\expall.dmp log= ...
- 2019年ArcGIS规划专业专项培训(四天)
2019年ArcGIS规划专业专项培训(四天) 商务合作,科技咨询,版权转让:向日葵,135-4855__4328,xiexiaokui#qq.com 第一天:GIS入门 第一章 GIS概述及其应 ...
- C++提示没有与这些操作数匹配的<<运算符
应该是忘了#include.#include<string>
- python制作简单excel统计报表2之操作excel的模块openpyxl简单用法
python制作简单excel统计报表2之操作excel的模块openpyxl简单用法 # coding=utf-8 from openpyxl import Workbook, load_workb ...
- Linux expect的安装与使用
Expect是在Tcl的基础上创建的,可以用来做一些Linux下无法做到交互的命令操作,可用于远程管理服务器. 一.安装Tcl: 1.下载源码包: wget http://nchc.dl.source ...
- Java PDF转换成图片并输出给前台展示
首先需要导入所需工具类 <dependency> <groupId>org.apache.pdfbox</groupId> <artifactId>fo ...
- java-mybaits-014-数据库缓存设计【querycache、mybatis一级缓存、二级缓存】
一.概述 一般来说,可以在5个方面进行缓存的设计: 1.最底层可以配置的是数据库自带的query cache, 2.mybatis的一级缓存,默认情况下都处于开启状态,只能使用自带的Perpetual ...
- Oracle中复制表的方法(create as select、insert into select、select into)
转: Oracle中复制表的方法(create as select.insert into select.select into) 2018-07-30 22:10:37 小白白白又白cdllp 阅读 ...
- 深入学习c++--智能指针(三) unique_ptr
1. 几种智能指针 1. auto_ptr: c++11中推荐不使用他(放弃) 2. shared_ptr: 拥有共享对象所有权语义的智能指针 3. unique_ptr: 拥有独有对象所有权语义的智 ...
- Qt编写气体安全管理系统9-数据查询
一.前言 数据查询模块在整个系统中难度最低,由于Qt对数据库操作的封装堪称完美,所以各种查询都是手到擒来,不费吹灰之力.Qt中内置了sqlite数据库,你可以在数据库插件目录sqldrivers发现q ...