更正应用程序的类路径,使其包含org.springframework.plugin.core.pluginregistry的一个兼容版本

k10s72fa  于 2021-07-13  发布在  Java
关注(0)|答案(1)|浏览(662)

我浏览了很多链接,比如-下面的方法不存在:'org.springframework.plugin.core.pluginregistry org.springframework.plugin.core.pluginregistry.of(java.util.list)',但是我还是发现了下面的错误-

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>

应用程序.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

m1m5dgzv

m1m5dgzv1#

让我们看看你的依赖树( 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 ,这将被跳过,因为您显式请求使用不同的版本。
您需要:
排除 spring-plugin-metadata 内部 springfox-swagger2 依赖关系声明,在 spring-plugin-metadata:2.0.0.RELEASE ,还有希望 spring-plugin-metadata:2.0.0.RELEASE 以及 spring-plugin-metadata:1.2.0.RELEASE 有兼容的API(他们可能没有)
更改的依赖项版本 spring-plugin-core1.2.0.RELEASE

相关问题