How to display app API documentation by using springdoc-openapi-webflux-ui?

后端 未结 1 540
囚心锁ツ
囚心锁ツ 2021-01-02 06:39

I read this https://springdoc.github.io/springdoc-openapi-demos/ documentation to use springdoc-openapi-webflux-ui. As documentation said I just added springdoc-openap

相关标签:
1条回答
  • 2021-01-02 07:14

    By default, you just need to add the dependency of the springdoc-openapi-webflux-ui.

     <dependency>
          <groupId>org.springdoc</groupId>
          <artifactId>springdoc-openapi-webflux-ui</artifactId>
          <version>1.2.32</version>
       </dependency>
    

    You can have a look at the demos code:

    • https://github.com/springdoc/springdoc-openapi-demos.git-

    You can check you classpath, and try to run the application from outside the IDE. Make sure you have the correct settings of your IDE depending on your build Tools:

    • https://github.com/springdoc/springdoc-openapi/issues/361

    Also, please check if you are using @EnableWebFlux.

    As stated in the Spring Boot reference documentation, when you use @EnableWebFlux, you tell Spring Boot that you wish to take full control over the WebFlux configuration and disable all auto-configuration for this (including static resources):

    • https://docs.spring.io/spring-boot/docs/current/reference/html/spring-boot-features.html#boot-features-webflux-auto-configuration

    You have two solutions:

    1. Remove @EnableWebFlux
    2. If you really want take control of Bean creation and you want absolutely to use @EnableWebFlux, then you need to add an implementation of WebFluxConfigurer.

    This has been discussed here:

    • https://github.com/springdoc/springdoc-openapi/issues/402
    0 讨论(0)
提交回复
热议问题