Assuming you have a Spring Boot application, using the @RestController annotations, you can generate both the Swagger JSON and the Swagger UI by dropping in a couple of libraries and a single configuration file. Here’s SpringFox.
Let’s start with the libraries. Maven example as follows.
Once the libraries are added, then you just need to drop in the SpringFox configuration.
If you notice, I added an IndexController that redirects requests to the root to the swagger UI.