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 父子上下文的说明 ...
随机推荐
- Linux服务器下日志截取
我们经常需要去Linux服务器上查看服务运行日志,但是有时候日志文件很大看起来很不方便,这个时候我们需要对日志进行切割筛选出自己需要的日志,比如查看某段时间内的日志,命令如下: sed -n '/ ...
- 【一】SpringMVC框架原理
springmvc基础知识 1.什么是springMVC 2.springMVC框架原理(掌握) 前端控制器.处理器映射器.处理器适配器.视图解析器 3.springmvc入门程序 目的:对前端控制器 ...
- 在linux的用户空间操作gpio
1. 使能linux内核选项CONFIG_GPIO_SYSFS CONFIG_GPIO_SYSFS=y 2. 测试方法 2.1 关注/sys/class/gpio下的文件 --export/unexp ...
- 初始化html font-size
(function () { var docEl = document.documentElement, resizeEvt = 'orientationchange' in window ? 'or ...
- flutter DateTime日期&时间选择器
import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; import 'dart:async'; class ...
- Ideal设置编码格式
file-------settings-------file Encodings
- Flink assignAscendingTimestamps 生成水印的三个重载方法
先简单介绍一下Timestamp 和Watermark 的概念: 1. Timestamp和Watermark都是基于事件的时间字段生成的 2. Timestamp和Watermark是两个不同的东西 ...
- Go 包导入备忘
一 包的导入语法 在写Go代码的时候经常用到import这个命令用来导入包文件,看到的方式参考如下: import( "fmt" ) ...
- xps转换为pdf
https://www.cnblogs.com/zeoy/archive/2013/01/09/2852941.html https://blog.csdn.net/jafucong/article/ ...
- 【docker 使用】基本docker命令
查看镜像 docker images 删除镜像 docker rmi [镜像id的前5位]或[镜像name:镜像tag] 如果有两个镜像指向同一个id,则使用镜像id进行删除时会报错,需要使用name ...