Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swagger2 WebFlux issue: Failed to start bean 'documentationPluginsBootstrapper'... when @EnableSwagger2WebFlux is present #3282

Closed
pstepnowski opened this issue Apr 10, 2020 · 2 comments
Labels

Comments

@pstepnowski
Copy link

pstepnowski commented Apr 10, 2020

Hey guys, I was spending some time trying to find out the cause but no luck.

My current setup:
kotlinVersion = '1.3.10'
springBootVersion = '2.0.2.RELEASE'

compile('org.springframework.boot:spring-boot-starter-webflux')
compile('io.springfox:springfox-swagger2:3.0.0-SNAPSHOT')
compile('io.springfox:springfox-spring-webflux:3.0.0-SNAPSHOT')

I'm getting:

2020-04-09 12:37:03,918 ERROR [main] [] org.springframework.boot.SpringApplication: Application run failed
org.springframework.context.ApplicationContextException: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NoSuchMethodError: org.springframework.plugin.core.PluginRegistry.getPluginOrDefaultFor(Ljava/lang/Object;Lorg/springframework/plugin/core/Plugin;)Lorg/springframework/plugin/core/Plugin;
	at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:184)
	at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:52)
	at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:356)
	at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:157)
	at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:121)
	at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:885)
	at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.finishRefresh(ReactiveWebServerApplicationContext.java:83)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:553)
	at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh(ReactiveWebServerApplicationContext.java:61)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:327)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1255)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1243)
	at com.xxx.xxx.xxx.MainKt.main(PriceApplication.kt:17)
Caused by: java.lang.NoSuchMethodError: org.springframework.plugin.core.PluginRegistry.getPluginOrDefaultFor(Ljava/lang/Object;Lorg/springframework/plugin/core/Plugin;)Lorg/springframework/plugin/core/Plugin;
	at springfox.documentation.spring.web.plugins.DocumentationPluginsManager.createContextBuilder(DocumentationPluginsManager.java:154)
	at springfox.documentation.spring.web.plugins.AbstractDocumentationPluginsBootstrapper.defaultContextBuilder(AbstractDocumentationPluginsBootstrapper.java:114)
	at springfox.documentation.spring.web.plugins.AbstractDocumentationPluginsBootstrapper.buildContext(AbstractDocumentationPluginsBootstrapper.java:92)
	at springfox.documentation.spring.web.plugins.AbstractDocumentationPluginsBootstrapper.bootstrapDocumentationPlugins(AbstractDocumentationPluginsBootstrapper.java:83)
	at springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper.start(DocumentationPluginsBootstrapper.java:94)
	at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:181)
	... 14 common frames omitted
Process finished with exit code 1

@pstepnowski pstepnowski changed the title Swagger2 WebFlux issue: Failed to start bean 'documentationPluginsBootstrapper'... when i @EnableSwagger2WebFlux is present Swagger2 WebFlux issue: Failed to start bean 'documentationPluginsBootstrapper'... when @EnableSwagger2WebFlux is present Apr 10, 2020
@MaksimOrlov
Copy link
Member

MaksimOrlov commented Apr 10, 2020

Hi, @pstepnowski. It happened due to mismatch spring-plugin-core version

To fix that you can add explicitly version of spring-plugin-core

<dependency>
  <groupId>io.springfox</groupId>
  <artifactId>springfox-swagger2</artifactId>
  <version>3.0.0-SNAPSHOT</version>
  <exclusions>
    <exclusion>
      <groupId>org.springframework.plugin</groupId>
      <artifactId>spring-plugin-core</artifactId>
    </exclusion>
  </exclusions>
</dependency>
<dependency>
  <groupId>io.springfox</groupId>
  <artifactId>springfox-swagger-ui</artifactId>
  <version>3.0.0-SNAPSHOT</version>
</dependency>
<dependency>
  <groupId>io.springfox</groupId>
  <artifactId>springfox-spring-webflux</artifactId>
  <version>3.0.0-SNAPSHOT</version>
  <exclusions>
    <exclusion>
      <groupId>org.springframework.plugin</groupId>
      <artifactId>spring-plugin-core</artifactId>
    </exclusion>
  </exclusions>
</dependency>
<dependency>
  <groupId>org.springframework.plugin</groupId>
  <artifactId>spring-plugin-core</artifactId>
  <version>2.0.0.RELEASE</version>
</dependency>

@pstepnowski
Copy link
Author

Amazing thanks @MaksimOrlov !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants