问题
I read this https://springdoc.github.io/springdoc-openapi-demos/ documentation to use springdoc-openapi-webflux-ui. As documentation said I just added springdoc-openapi-webflux-ui
library to my app: implementation('org.springdoc:springdoc-openapi-webflux-ui:1.2.26')
Additionally, I customized path to API in application.yml:
springdoc:
swagger-ui:
path: /swagger-ui.html
When I start app, and go to http://localhost:8080/swagger-ui.html, it redirects me to http://localhost:8080/webjars/swagger-ui/index.html?configUrl=/v3/api-docs/swagger-config. In that page, I got an error:
Whitelabel Error Page
This application has no configured error view, so you are seeing this as a fallback.
Mon Jan 20 05:16:10 UTC 2020
[7192d9dc] There was an unexpected error (type=Not Found, status=404).
No matching handler
Question is: Should I add additional configurations to my app to show API documentation?
PS: I use spring.boot 2.2.2:RELEASE
回答1:
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.28</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
来源:https://stackoverflow.com/questions/59817409/how-to-display-app-api-documentation-by-using-springdoc-openapi-webflux-ui