Change location to call swagger-ui in Spring -


how can change location call swagger api docs http://localhost:8081/swagger-ui.html http://localhost:8081/my-api-doc?

my swaggerconfig is

@configuration @enableswagger2 public class swaggerconfig {     @bean     public docket api() {         return new docket(documentationtype.swagger_2)                 .select()                 .apis(requesthandlerselectors.basepackage("com.package"))                 .paths(pathselectors.any())                 .build()                 .apiinfo(apiinfo());     } 

and use springfox-swagger2 , springfox-swagger-ui both version 2.7.0.

this can did it.

    @override     public void addviewcontrollers(viewcontrollerregistry registry) {              registry.addredirectviewcontroller("/documentation/v2/api-docs", "/v2/api-docs?group=restful-api");             registry.addredirectviewcontroller("/documentation/swagger-resources/configuration/ui","/swagger-resources/configuration/ui");             registry.addredirectviewcontroller("/documentation/swagger-resources/configuration/security","/swagger-resources/configuration/security");             registry.addredirectviewcontroller("/documentation/swagger-resources", "/swagger-resources");             registry.addredirectviewcontroller("/documentation", "/documentation/swagger-ui.html");     }       @override     public void addresourcehandlers(resourcehandlerregistry registry) {              registry.                      addresourcehandler("/documentation/swagger-ui.html**").addresourcelocations("classpath:/meta-inf/resources/swagger-ui.html");             registry.                     addresourcehandler("/documentation/webjars/**").addresourcelocations("classpath:/meta-inf/resources/webjars/");     } 

this methods added in configuration class extend webmvcconfigureradapter public class configuration extends webmvcconfigureradapter {...}

you can't remove swagger-ui.html or change because hard-coded in source code.


Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -