📜  springdoc-openapi-ui (1)

📅  最后修改于: 2023-12-03 15:05:16.774000             🧑  作者: Mango

Introducing springdoc-openapi-ui

springdoc-openapi-ui is a tool that generates OpenAPI (formerly known as Swagger) documentation for your Spring Boot applications. It is built on top of the Spring WebFlux framework and supports both Java and Kotlin.

Features

Some of the key features of springdoc-openapi-ui include:

  • Automatic generation of OpenAPI documentation based on your Spring controllers and models
  • Customize the documentation with annotations and configuration options
  • Automatic detection and display of JSON and XML data models
  • Interactive user interface for exploring the API documentation
  • Support for Swagger UI and ReDoc as the user interface
Getting started

To start using springdoc-openapi-ui, you need to add the following Maven dependency to your project:

<dependency>
    <groupId>org.springdoc</groupId>
    <artifactId>springdoc-openapi-ui</artifactId>
    <version>{latest.version}</version>
</dependency>

You can also use Gradle to add the dependency:

implementation 'org.springdoc:springdoc-openapi-ui:{latest.version}'

Once you have added the dependency, you can start annotating your Spring controllers and models with OpenAPI annotations to customize the documentation. You can also configure the tool with various options to control the behavior of the tool.

To access the documentation, simply navigate to the following URL:

http://localhost:8080/swagger-ui.html

This will display the Swagger UI interface where you can explore the API and test the endpoints.

Conclusion

Overall, springdoc-openapi-ui is a great tool for generating API documentation for your Spring Boot applications. It is easy to use, highly customizable, and provides an interactive interface for exploring the API. If you are working on a Spring Boot project, you should definitely give it a try!