Была предпринята попытка вызвать метод, который не существует. Попытка была сделана из следующего местоположения: - PullRequest
1 голос
/ 16 марта 2020

Я работаю над Spring boot JPA Gridle project. Текущий Swagger работает, и ошибка происходит, пока DTO выполняется. Модули, кажется, сталкиваются друг с другом.

Ошибка возникает, когда я устанавливаю модуль swagger, продолжаю чванство и устанавливаю модуль для DTO. Следующие модули выдают ошибку:

compile 'org.springframework.boot:spring-boot-starter-hateoas'

И ошибка выглядит следующим образом.

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-03-17 01:26:38.657 ERROR 4688 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
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.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:/Users/****/.gradle/caches/modules-2/files-2.1/org.springframework.plugin/spring-plugin-core/2.0.0.RELEASE/95fc8c13037630f4aba9c51141f535becec00fe6/spring-plugin-core-2.0.0.RELEASE.jar!/org/springframework/plugin/core/PluginRegistry.class

It was loaded from the following location:

    file:/Users/****/.gradle/caches/modules-2/files-2.1/org.springframework.plugin/spring-plugin-core/2.0.0.RELEASE/95fc8c13037630f4aba9c51141f535becec00fe6/spring-plugin-core-2.0.0.RELEASE.jar


Action:

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


Process finished with exit code 1

То, что я пробовал в процессе поиска, тоже.

compile group: 'org.springframework.plugin', name: 'spring-plugin-core', version: '2.0.0.RELEASE'

compile group: 'io.springfox', name: 'springfox-data-rest', version: '2.9.2'

Ни один из них не помог мне.

У кого-нибудь есть такая же проблема, как у меня?

Есть ли другой способ решить эту проблему?

1 Ответ

0 голосов
/ 24 марта 2020

Проблема заключалась в конфликте между модулями Swagger и Hateoas. Ряд результатов поиска нашел решение.

Решением было добавить новый модуль и зарегистрировать Bean для него.

compile group: 'org.springframework.plugin', name: 'spring-plugin-core', version: '1.2.0.RELEASE'

SwaggerConfig. java

public class SwaggerConfig {

    @Bean
    public LinkDiscoverers discoverers() {
        List<LinkDiscoverer> plugins = new ArrayList<>();
        plugins.add(new CollectionJsonLinkDiscoverer());
        return new LinkDiscoverers(SimplePluginRegistry.create(plugins));
    }

}
...