SpringBoot 集成Swagger3,spring-plugin-core提示不匹配
Posted 在奋斗的大道
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了SpringBoot 集成Swagger3,spring-plugin-core提示不匹配相关的知识,希望对你有一定的参考价值。
今天使用SpringBoot集成Swagger 输出如下错误信息:
***************************
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call the method org.springframework.plugin.core.PluginRegistry.getPluginFor(Ljava/lang/Object;)Ljava/util/Optional; but it does not exist. Its class, org.springframework.plugin.core.PluginRegistry, is available from the following locations:
jar:file:/C:/programs/maven/localHouse/org/springframework/plugin/spring-plugin-core/1.2.0.RELEASE/spring-plugin-core-1.2.0.RELEASE.jar!/org/springframework/plugin/core/PluginRegistry.class
It was loaded from the following location:
file:/C:/programs/maven/localHouse/org/springframework/plugin/spring-plugin-core/1.2.0.RELEASE/spring-plugin-core-1.2.0.RELEASE.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of org.springframework.plugin.core.PluginRegistry
按照错误提示,怀疑是包冲突,于是执行mvn dependency:tree >tree.log进行maven依赖查看,结果spring-plugin-core 1.2.0-RELEASE只有springfox在使用(即Swagger3),所以并不存在冲突的问题
解决方案:强制将依赖版本升级到2.0,问题解决
<!-- swagger3 接口文档生成器 -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>3.0.0</version>
<exclusions>
<exclusion>
<groupId>org.springframework.plugin</groupId>
<artifactId>spring-plugin-core</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework.plugin</groupId>
<artifactId>spring-plugin-metadata</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.plugin</groupId>
<artifactId>spring-plugin-core</artifactId>
<version>2.0.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.plugin</groupId>
<artifactId>spring-plugin-metadata</artifactId>
<version>2.0.0.RELEASE</version>
</dependency>
以上是关于SpringBoot 集成Swagger3,spring-plugin-core提示不匹配的主要内容,如果未能解决你的问题,请参考以下文章
SpringBoot集成Swagger3接口文档及添加Authorization授权
SpringBoot 集成Swagger3,spring-plugin-core提示不匹配
SpringBoot集成Swagger3,还想来份离线文档?真酷炫
SpringBoot 集成FluentMyBatis 框架之完善
springboot2 集成 swagger3.0 使用了拦截器 出现报错 end of the stream or a document separator is expected