Documenting microservices
The traditional approach of API documentation is either to write service specification documents or to use static service registries. With a large number of microservices, it would be hard to keep the documentation of APIs in sync.
Microservices can be documented in many ways. This section will explore how microservices can be documented using the popular Swagger framework. In the following examples, we will use Springfox
libraries for generating REST API documentation. Springfox
is a set of Java Spring-friendly library.
Create a new Spring Starter
project, and choose Web
in the library selection window. Name the project as chapter3.swagger.
Note
The full source code of this example is available as the chapter3.swagger
project in the code files of this book under the following Git repository:https://github.com/rajeshrv/Spring5Microservice
Since Springfox
libraries are not part of the Spring suite, edit the pom.xml
file, and add the springfox-swagger
library dependencies...