Part 1: How To Add OpenAPI 3.0 And Swagger To Spring Boot Application

Wei Kang
Javarevisited
Published in
2 min readOct 17, 2021

--

Learn one of the ways to add OpenAPI 3.0 and Swagger to the Spring Boot application.

Photo by NeONBRAND on Unsplash

When building REST APIs, it is essential to have documentation so that it is easier to find out what are the APIs that have been built. In this article, I will be sharing how we could add OpenAPI 3.0 and Swagger to our Spring Boot application.

The library that we will need is the springdoc-openapi java library. springdoc-openapi is a library that helps to automate the generation of API documentation using Spring Boot projects. It works by examining an application at runtime to infer API semantics based on Spring configurations, class structure, and various annotations.

Without any other configuration, you should be able to visit the following pages:

  • OpenAPI doc: http://server:port/v3/api-docs
  • Swagger UI page: http://server:port/swagger-ui.html

--

--