Springboot2.2.0.M1 +swagger2 报错

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

springfox.documentation.spring.web.plugins.DocumentationPluginsManager.createContextBuilder(DocumentationPluginsManager.java:152)

The following method did not exist:

org.springframework.plugin.core.PluginRegistry.getPluginFor(Ljava/lang/Object;Lorg/springframework/plugin/core/Plugin;)Lorg/springframework/plugin/core/Plugin;

The method's class, org.springframework.plugin.core.PluginRegistry, is available from the following locations:

jar:file:/E:/apache-maven-3.6.0/repository_all/org/springframework/plugin/spring-plugin-core/2.0.0.M1/spring-plugin-core-2.0.0.M1.jar!/org/springframework/plugin/core/PluginRegistry.class

It was loaded from the following location:

file:/E:/apache-maven-3.6.0/repository_all/org/springframework/plugin/spring-plugin-core/2.0.0.M1/spring-plugin-core-2.0.0.M1.jar

Action:

Correct the classpath of your application so that it contains a single, compatible version of org.springframework.plugin.core.PluginRegistry


io.springfox
springfox-swagger2
2.9.2


io.springfox
springfox-swagger-ui
2.9.2

看情况是jar包冲突没有找到:

这个包是springfox-swagger2.jar依赖引入的,但是找不出是那里冲突了,为什么找不到类

该问题已解决:强制依赖

<dependency>
            <groupId>org.springframework.plugin</groupId>
            <artifactId>spring-plugin-core</artifactId>
            <version>1.2.0.RELEASE</version><!--$NO-MVN-MAN-VER$-->
        </dependency>
        <dependency>
            <groupId>org.springframework.plugin</groupId>
            <artifactId>spring-plugin-metadata</artifactId>
             <version>1.2.0.RELEASE</version><!--$NO-MVN-MAN-VER$-->
        </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>
<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>

我也遇到一样的问题,不过我的springfox版本是 3.0.0-SNAPSHOT, 因为我这边用了 webflux ,而 springfox迟迟没发布 3.0.0, 只好先用快照将就下.
我的解决方法是把 spring-plugin-core 和 spring-plugin-metadata 强制升级到 2.0.0:

<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>

把依赖spring-plugin-core2.0.0 的去掉。spring-plugin-core的两个版本冲突了