programing

'org.springframework' 메서드가 없습니다.플러그인.core.플러그인 레지스트리 org.스프링 프레임워크.플러그인.core.플러그인Registry.of(java.util).리스트)'

starjava 2023. 7. 1. 07:58
반응형

'org.springframework' 메서드가 없습니다.플러그인.core.플러그인 레지스트리 org.스프링 프레임워크.플러그인.core.플러그인Registry.of(java.util).리스트)'

pom.xml

<dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-tomcat</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

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

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

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>runtime</scope>
        </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>

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.18.12</version>
            <scope>provided</scope>
        </dependency>

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

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

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

        <!-- The Bad Boy -->
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-rest-hal-browser</artifactId>
            <version>3.2.5.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.plugin</groupId>
            <artifactId>spring-plugin-core</artifactId>
            <version>1.2.0.RELEASE</version>
        </dependency>
    </dependencies>

이러한 종속성으로 인해 다음 오류가 발생합니다.

    *************************** 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:/home/md7zn4/.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

    It was loaded from the following location:

        file:/home/md7zn4/.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

Hal Browser Dependency를 삭제하면 모든 것이 정상적으로 작동합니다.

        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-rest-hal-browser</artifactId>
            <version>3.2.5.RELEASE</version>
        </dependency>

업데이트를 시도했습니다.spring-plugin-core로.2.0.0-RELEASE하지만 이번에는 다음과 같은 오류가 발생합니다.

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

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

The following method did not exist:

    'org.springframework.plugin.core.Plugin org.springframework.plugin.core.PluginRegistry.getPluginFor(java.lang.Object, org.springframework.plugin.core.Plugin)'

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

    jar:file:/home/md7zn4/.m2/repository/org/springframework/plugin/spring-plugin-core/2.0.0.RELEASE/spring-plugin-core-2.0.0.RELEASE.jar!/org/springframework/plugin/core/PluginRegistry.class

이것도 확인합니다.

에 대한 충돌이 있는 것 같습니다.spring-plugin-core이걸 어떻게 고칠 수 있을까요?

원인

이 오류가 표시되는 경우:

The following method did not exist:

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

스프링 플러그인 코어 1.2.0이 적용된다는 의미입니다.이는 springfox-swagger2 v2.9.2에 적합하지만 일부 다른 구성 요소는 PluginRegistry.of(java.util)를 찾을 수 없습니다.목록)은 이후 버전에서 정의되었기 때문에 스프링 플러그인 코어에 있습니다.

이 오류가 표시되는 경우:

The following method did not exist:

'org.springframework.plugin.core.Plugin org.springframework.plugin.core.PluginRegistry.getPluginFor(java.lang.Object, org.springframework.plugin.core.Plugin)'

스프링 플러그인 코어 2.0.0이 적용됨을 의미합니다.이번에는 PluginRegistry.getPluginFor(java.lang)로 인해 springfox-swagger2 v2.9.2에 문제가 발생합니다.객체, 조직 스프링 프레임워크.플러그인.core.플러그인)이 이 버전에서 제거되었습니다.

해결책

이 문제는 springfox 라이브러리의 스냅샷 버전을 사용하여 해결할 수 있습니다.스프링 플러그인 코어의 최신 버전을 사용하도록 업그레이드되었습니다.

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

이 스냅샷 버전을 사용하려면 저장소 정의를 추가하십시오.

<repositories>
  <repository>
    <id>jcenter-snapshots</id>
    <name>jcenter</name>
    <url>http://oss.jfrog.org/artifactory/oss-snapshot-local/</url>
  </repository>
</repositories>

또한 @EnableSwagger2를 @EnableSwagger2WebMvc로 대체하십시오.

Spring Plugins 버전이 낮습니다. 이 버전을 pom.xml에 추가합니다.

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

유사한 문제는 여기에서 찾을 수 있습니다: https://github.com/springfox/springfox/issues/2968

저 같은 경우에는 스웨거 버전만 업그레이드하면 효과가 있었습니다.

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

나도 같은 문제에 직면했고 이것이 나에게 효과가 있었습니다.

1. HAL 브라우저 대신 HAL 탐색기 사용

2.Springfox 종속성 버전 업데이트

    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-rest-hal-explorer</artifactId>
    </dependency>
    <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-swagger2</artifactId>
        <version>3.0.0</version>
    </dependency>
    <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-swagger-ui</artifactId>
        <version>2.9.2</version>
    </dependency>

maven dependency tree 명령을 실행하여 두 개의 jar가 포함되어 있는지 확인하고 하나를 제거하거나 더 쉬운 방법은 .m2 폴더를 삭제하고 문제를 해결할 종속성을 다시 가져오는 것입니다.

언급URL : https://stackoverflow.com/questions/60710084/the-following-method-did-not-exist-org-springframework-plugin-core-pluginregis

반응형