Я интегрирую Swagger в приложение Springboot, которое обращается к mongodb. Я получаю следующую ошибку при попытке запустить приложение.
2020-04-27 14:24:34,890 main DEBUG org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter : Application failed to start due to an exception
java.lang.NoSuchMethodError: org/springframework/plugin/core/PluginRegistry.getPluginFor(Ljava/lang/Object;Lorg/springframework/plugin/core/Plugin;)Lorg/springframework/plugin/core/Plugin; (loaded from file:/C:/Users/me/.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 by sun.misc.Launcher$AppClassLoader@c27959c4) called from class springfox.documentation.spring.web.plugins.DocumentationPluginsManager (loaded from file:/C:/Users/me/.gradle/caches/modules-2/files-2.1/io.springfox/springfox-spring-web/2.9.2/ed2ed714a6cba8804d00f80f0534901e4c7a3211/springfox-spring-web-2.9.2.jar by sun.misc.Launcher$AppClassLoader@c27959c4).
at springfox.documentation.spring.web.plugins.DocumentationPluginsManager.createContextBuilder(DocumentationPluginsManager.java:152)
at springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper.defaultContextBuilder(DocumentationPluginsBootstrapper.java:116)
at springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper.buildContext(DocumentationPluginsBootstrapper.java:96)
**- springboot version - 2.2.6.RELEASE
- swagger version - implementation
'io.springfox:springfox-swagger2:2.9.2'**
Also i have @EnableSwagger2 annotation and below bean defined
@Bean
public Docket api() {
ApiInfo apiInfo = new ApiInfoBuilder()
.title("app")
.description("This service is used to provide ")
.build();
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.basePackage("com.app"))
.paths(PathSelectors.any())
.build()
.apiInfo(apiInfo);
}
Я не уверен, как решить эту проблему?
Добавление дерева зависимостей для spring-data-rest. Как исключить spring-plugin-core в gradle?
+--- org.springframework.boot:spring-boot-starter-data-rest:2.2.6.RELEASE
| +--- org.springframework.boot:spring-boot-starter-web:2.2.6.RELEASE (*)
| \--- org.springframework.data:spring-data-rest-webmvc:3.2.6.RELEASE
| +--- org.springframework.data:spring-data-rest-core:3.2.6.RELEASE
| | +--- org.springframework:spring-tx:5.2.5.RELEASE (*)
| | +--- org.springframework.hateoas:spring-hateoas:1.0.4.RELEASE
| | | +--- org.springframework:spring-aop:5.2.5.RELEASE (*)
| | | +--- org.springframework:spring-beans:5.2.5.RELEASE (*)
| | | +--- org.springframework:spring-context:5.2.5.RELEASE (*)
| | | +--- org.springframework:spring-core:5.2.5.RELEASE (*)
| | | +--- org.springframework:spring-web:5.2.5.RELEASE (*)
| | | +--- org.springframework.plugin:spring-plugin-core:2.0.0.RELEASE
| | | | +--- org.springframework:spring-beans:5.2.0.RELEASE -> 5.2.5.RELEASE (*)
| | | | +--- org.springframework:spring-context:5.2.0.RELEASE -> 5.2.5.RELEASE (*)
| | | | +--- org.springframework:spring-aop:5.2.0.RELEASE -> 5.2.5.RELEASE (*)
| | | | \--- org.slf4j:slf4j-api:1.7.25 -> 1.7.30
| | | +--- com.jayway.jsonpath:json-path:2.4.0
| | | | +--- net.minidev:json-smart:2.3
| | | | | \--- net.minidev:accessors-smart:1.2
| | | | | \--- org.ow2.asm:asm:5.0.4
| | | | \--- org.slf4j:slf4j-api:1.7.25 -> 1.7.30
| | | \--- org.slf4j:slf4j-api:1.7.30
| | +--- org.springframework:spring-webmvc:5.2.5.RELEASE (*)
| | +--- org.springframework.data:spring-data-commons:2.2.6.RELEASE (*)
| | +--- org.springframework.plugin:spring-plugin-core:2.0.0.RELEASE (*)
Ниже дерева зависимостей для swagger.its я уже давно пытаюсь решить эту проблему. за помощь.
+--- io.springfox:springfox-swagger2:2.9.0
| +--- io.swagger:swagger-annotations:1.5.18
| +--- io.swagger:swagger-models:1.5.18
| | +--- com.fasterxml.jackson.core:jackson-annotations:2.9.3 -> 2.10.3
| | +--- org.slf4j:slf4j-api:1.7.22 -> 1.7.30
| | \--- io.swagger:swagger-annotations:1.5.18
| +--- io.springfox:springfox-spi:2.9.0
| | \--- io.springfox:springfox-core:2.9.0
| | +--- net.bytebuddy:byte-buddy:1.8.8
| | +--- com.google.guava:guava:20.0
| | +--- com.fasterxml:classmate:1.4.0
| | +--- org.slf4j:slf4j-api:1.7.25 -> 1.7.30
| | +--- org.springframework.plugin:spring-plugin-core:1.2.0.RELEASE -> 2.0.0.RELEASE (*)
| | \--- org.springframework.plugin:spring-plugin-metadata:1.2.0.RELEASE
| | +--- org.springframework.plugin:spring-plugin-core:1.2.0.RELEASE -> 2.0.0.RELEASE (*)
| | \--- org.slf4j:slf4j-api:1.7.10 -> 1.7.30
| +--- io.springfox:springfox-schema:2.9.0
| | +--- io.springfox:springfox-core:2.9.0 (*)
| | \--- io.springfox:springfox-spi:2.9.0 (*)
| +--- io.springfox:springfox-swagger-common:2.9.0
| | +--- io.swagger:swagger-annotations:1.5.18
| | +--- io.swagger:swagger-models:1.5.18 (*)
| | +--- io.springfox:springfox-spi:2.9.0 (*)
| | +--- io.springfox:springfox-schema:2.9.0 (*)
| | +--- io.springfox:springfox-spring-web:2.9.0
| | | +--- com.google.guava:guava:20.0
| | | +--- com.fasterxml:classmate:1.4.0
| | | +--- org.slf4j:slf4j-api:1.7.25 -> 1.7.30
| | | +--- org.springframework.plugin:spring-plugin-core:1.2.0.RELEASE -> 2.0.0.RELEASE (*)
| | | +--- org.springframework.plugin:spring-plugin-metadata:1.2.0.RELEASE (*)
| | | \--- io.springfox:springfox-spi:2.9.0 (*)
| | +--- com.google.guava:guava:20.0
| | +--- com.fasterxml:classmate:1.4.0
| | +--- org.slf4j:slf4j-api:1.