Documentation with Swagger

Swagger is a really awesome project that will allow you to document and interact with your API within an HTML5 webpage. The following screenshot illustrates the API documentation:

Documentation with Swagger

Swagger used to be big (written in Scala) and somewhat complicated to configure with a Spring setup. Since version 2.0, the library has been rewritten and a really neat project called spring-fox will allow for easy integration.

Note

spring-fox, formerly known as swagger-springmvc, has been in existence for more than three years and is still a very active project.

Add the following dependencies to your build file:

compile 'io.springfox:springfox-swagger2:2.1.2' ...

Get Spring MVC: Designing Real-World Web Applications 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.