Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

People also ask

How does Springdoc work?

springdoc-openapi works by examining an application at runtime to infer API semantics based on spring configurations, class structure and various annotations. Automatically generates documentation in JSON/YAML and HTML format APIs. This documentation can be completed by comments using swagger-api annotations.

How can I define multiple OpenAPI definitions in one spring boot project?

How can I define multiple OpenAPI definitions in one Spring Boot project? You can define your own groups of API based on the combination of: API paths and packages to scan. Each group should have a unique groupName .

What is OpenAPI in Java?

An open API, also called public API, is an application programming interface made publicly available to software developers. Open APIs are published on the internet and shared freely, allowing the owner of a network-accessible service to give a universal access to consumers.

How do I get to swagger UI?

Go to http://localhost:8000/ in your address bar. This address lets you view the local web server. By default, web servers default to the index. html file in the directory, so it will show the Swagger UI file automatically.


I read this https://springdoc.org/demos.html 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