Generating ;a Swagger specification

One of the interesting developments in the last few years of RESTful services development is the evolution of tools to generate service documentation (specification) from the code. This ensures that the code and documentation are always in sync.

Springfox Swagger can be used to generate Swagger documentation from the RESTful services code. What's more, there is a wonderful tool called Swagger UI, which, when integrated into the application, provides human-readable documentation.

The following code snippet shows how we can add both these tools ;to the ;pom.xml file:

    <dependency>     <groupId>io.springfox</groupId>     <artifactId>springfox-swagger2</artifactId>     <version>2.4.0</version>    </dependency> <dependency> ...

Get Mastering Spring 5.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.