或调整应用程序的类路径,使其包含单个兼容版本的org.springframework.plugin.core.PluginRegistry [英] orrect the classpath of your application so that it contains a single, compatible version of org.springframework.plugin.core.PluginRegistry

查看:16
本文介绍了或调整应用程序的类路径,使其包含单个兼容版本的org.springframework.plugin.core.PluginRegistry的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过了许多链接,如-The following method did not exist: 'org.springframework.plugin.core.PluginRegistry org.springframework.plugin.core.PluginRegistry.of(java.util.List)',但我仍然在Error-

下方
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
[2m2021-04-03 16:16:57.381[0;39m [31mERROR[0;39m [35m16532[0;39m [2m---[0;39m [2m[  restartedMain][0;39m [36mo.s.b.d.LoggingFailureAnalysisReporter  [0;39m [2m:[0;39m 

***************************
APPLICATION FAILED TO START
***************************

Description:

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

    org.springframework.data.rest.core.support.UnwrappingRepositoryInvokerFactory.<init>(UnwrappingRepositoryInvokerFactory.java:57)

The following method did not exist:

    'org.springframework.plugin.core.PluginRegistry org.springframework.plugin.core.PluginRegistry.of(java.util.List)'

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

    jar:file:/C:/Users/pc/.m2/repository/org/springframework/plugin/spring-plugin-core/1.2.0.RELEASE/spring-plugin-core-1.2.0.RELEASE.jar!/org/springframework/plugin/core/PluginRegistry.class

The class hierarchy was loaded from the following locations:

    org.springframework.plugin.core.PluginRegistry: file:/C:/Users/pc/.m2/repository/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

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.3.4.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.techefx.microservices</groupId>
    <artifactId>techefx-property-access-service</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>techefx-property-access-service</name>
    <description>My Property File Access Service</description>

    <properties>
        <java.version>14</java.version>
        <spring-cloud.version>Hoxton.SR10</spring-cloud.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        
        <dependency>
            <groupId>org.springframework.plugin</groupId>
            <artifactId>spring-plugin-core</artifactId>
            <version>2.0.0.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-rest-hal-explorer</artifactId>
        </dependency>

        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>2.7.0</version>
        </dependency>

        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>2.7.0</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-config</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.junit.vintage</groupId>
                    <artifactId>junit-vintage-engine</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>${spring-cloud.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>13</source>
                    <target>13</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

Application.yml

spring:
  application:
    name: techefx-property-access-service
  profiles:
    active: dev

server:
  port: ${port:8100}


management:
  endpoints:
    web:
      exposure:
        include: refresh

源代码在此处-https://github.com/techefx/techefx-property-access-service

推荐答案

让我们看看您的依赖关系树(mvn dependency:tree):

[INFO] +- org.springframework.plugin:spring-plugin-core:jar:2.0.0.RELEASE:compile
[INFO] |  +- org.springframework:spring-beans:jar:5.2.9.RELEASE:compile
[INFO] |  +- org.springframework:spring-context:jar:5.2.9.RELEASE:compile
[INFO] |  +- org.springframework:spring-aop:jar:5.2.9.RELEASE:compile
...
[INFO] +- io.springfox:springfox-swagger2:jar:2.7.0:compile
[INFO] |  +- io.swagger:swagger-annotations:jar:1.5.13:compile
[INFO] |  +- io.swagger:swagger-models:jar:1.5.13:compile
[INFO] |  +- io.springfox:springfox-spi:jar:2.7.0:compile
[INFO] |  |  - io.springfox:springfox-core:jar:2.7.0:compile
[INFO] |  +- io.springfox:springfox-schema:jar:2.7.0:compile
[INFO] |  +- io.springfox:springfox-swagger-common:jar:2.7.0:compile
[INFO] |  +- io.springfox:springfox-spring-web:jar:2.7.0:compile
[INFO] |  |  - org.reflections:reflections:jar:0.9.11:compile
[INFO] |  |     - org.javassist:javassist:jar:3.21.0-GA:compile
[INFO] |  +- com.google.guava:guava:jar:29.0-jre:compile
[INFO] |  |  +- com.google.guava:failureaccess:jar:1.0.1:compile
[INFO] |  |  +- com.google.guava:listenablefuture:jar:9999.0-empty-to-avoid-conflict-with-guava:compile
[INFO] |  |  +- com.google.code.findbugs:jsr305:jar:3.0.2:compile
[INFO] |  |  +- org.checkerframework:checker-qual:jar:2.11.1:compile
[INFO] |  |  +- com.google.errorprone:error_prone_annotations:jar:2.3.4:compile
[INFO] |  |  - com.google.j2objc:j2objc-annotations:jar:1.3:compile
[INFO] |  +- com.fasterxml:classmate:jar:1.5.1:compile
[INFO] |  +- org.springframework.plugin:spring-plugin-metadata:jar:1.2.0.RELEASE:compile

似乎springfox-swagger2正在拉入spring-plugin-metadata:jar:1.2.0.RELEASE。该依赖项需要spring-plugin-core:jar:1.2.0.RELEASE,但已跳过,因为您显式请求使用其他版本。

您需要:

  • springfox-swagger2依赖项声明中为spring-plugin-metadata添加一个排除项,在spring-plugin-metadata:2.0.0.RELEASE上添加一个显式依赖项,并希望spring-plugin-metadata:2.0.0.RELEASEspring-plugin-metadata:1.2.0.RELEASE有兼容的API(它们很可能没有)
  • spring-plugin-core的依赖项版本更改为1.2.0.RELEASE

这篇关于或调整应用程序的类路径,使其包含单个兼容版本的org.springframework.plugin.core.PluginRegistry的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆