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

springdoc-openapi-webflux-ui 2.0.0-M7 + spring actuator + spring cloud crashes at startup #1904

Closed
magnus-larsson opened this issue Oct 23, 2022 · 7 comments
Labels
bug Something isn't working

Comments

@magnus-larsson
Copy link

Describe the bug
This seems related to issues #1607 and #1617, maybe a remaining corner case?

If the following configuration is used, the application fails to start:

management.endpoints.web.exposure.include: "*"

The error message is the same as in #1607 and #1617:

***************************
APPLICATION FAILED TO START
***************************

Description:

Parameter 0 of method webConversionServiceProvider in org.springdoc.core.configuration.SpringDocConfiguration$WebConversionServiceConfiguration required a single bean, but 2 were found:
        - webFluxConversionService: defined by method 'webFluxConversionService' in class path resource [org/springframework/boot/autoconfigure/web/reactive/WebFluxAutoConfiguration$EnableWebFluxConfiguration.class]
        - integrationConversionService: defined in null

The following versions are used:

  1. Spring Boot v3.0.0-RC1
  2. Spring Cloud v2022.0.0-M5
  3. springdoc-openapi-starter-webflux-ui v2.0.0-M7

Sample
product-composite-service.zip

To Reproduce
Steps to reproduce the behavior:

  1. Unzip the attached sample code.

  2. Build and start the server with: ./gradlew clean test bootRun

  3. Run the following curl commands to verify it works as expcted:

    curl localhost:7000/api -so /dev/null -w "%{http_code}\n"
    curl localhost:7000/openapi/swagger-ui.html -Lso /dev/null -w "%{http_code}\n"
    curl localhost:7000/openapi/webjars/swagger-ui/index.html -so /dev/null -w "%{http_code}\n"
    curl localhost:7000/openapi/v3/api-docs -so /dev/null -w "%{http_code}\n"
    curl localhost:7000/openapi/v3/api-docs.yaml -so /dev/null -w "%{http_code}\n"
    

    Expect them all to return 200.

  4. Stop the application

  5. Edit src/main/resources/application.yml and remove the comment mark before:

    management.endpoints.web.exposure.include: "*"
    
  6. Start the application again and it will now fail with the error message shown above.

Expected behavior
That the application starts up normally and the curl commands mentioned above all return 200, when using the setting management.endpoints.web.exposure.include: "*".

@magnus-larsson
Copy link
Author

The startup problem described above can also be triggered by injecting a StreamBridge instance in the MyService - class, e.g., adding the lines:

  @Autowired
  private StreamBridge streamBridge;

@davidmelia
Copy link

Also occurs when adding spring cloud stream

      	<dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-stream-binder-kafka</artifactId>
        </dependency>  	

bnasslahsen added a commit that referenced this issue Nov 14, 2022
@bnasslahsen
Copy link
Contributor

@magnus-larsson and @davidmelia,

You can test with the latest SNAPSHOT and let me know if fixes this problem.

@bnasslahsen bnasslahsen added the bug Something isn't working label Nov 14, 2022
@magnus-larsson
Copy link
Author

Great, thanks!

I tried to locate your snapshot repo, and found https://s01.oss.sonatype.org/content/repositories/snapshots in https://github.com/springdoc/springdoc-openapi/blob/master/pom.xml.

But it does not seem to contain any updated snapshot build of v2.0.0.
The latest artefact in https://s01.oss.sonatype.org/content/repositories/snapshots/org/springdoc/springdoc-openapi-starter-webflux-ui/2.0.0-SNAPSHOT/ is from April.

Where can I find the latest snapshot builds of v2.0.0?

@bnasslahsen
Copy link
Contributor

@magnus-larsson
Copy link
Author

Ok, I see, thanks! Yes, it seems to work fine now. I'll make some more tests with my actual application tomorrow.

@magnus-larsson
Copy link
Author

Yes, it works fine with my application as well. Thanks for the correction!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants