Here we will document our api using swagger. Swagger is just an amazing tool to document our api. This is really helpful for the client side developer as he can easily see what methods to call in the client side. We will be generating html format documentation with the help of swagger.
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
We are all set to go. Dont forget to run clean maven build. Now rerun the server again and we will see the following output in the link - http://localhost:8080/swagger-ui.html#/. After opening the link will look like this.
Just open the server controller and it will look like this. We can see the url mapping that we have mentioned in our springboot application.
Click on get and then click on try out and then press execute. We will get all the objects stored in mongo database.