I am using Springfox v 2.7 and I'd like to generate my Swagger UI from a JSON file, to keep my Controller classes clean, and without annotations from Swawgger (@Api, @ApiDocs) either my model classes without any annotation (@ApiModelProperty, etc)....
Regards!
PD: This is a Spring boot 1.5.8 version App.
Here are the changes you need to make:
Only Springfox JAR needed is springfox-swagger-ui
JAR which contains all the static UI artifacts.
A swagger.json
file containing all the JSON definition located under the resources
folder.
A custom controller having the following endpoints to meet all the requests from the swagger-ui.html
:
/swagger-resources
endpoint which returns a JSON string representation of a springfox.documentation.swagger.web.SwaggerResource
object.
/swagger-resources/configuration/ui
endpoint which returns a JSON string representation of a springfox.documentation.swagger.web.UiConfiguration
object.
/swagger-resources/configuration/security
endpoint which returns a JSON string representation of a springfox.documentation.swagger.web.SecurityConfiguration
object.
/v2/api-docs
endpoint which returns a JSON representation of a Swagger API definition.
You can find a working example here.