How I can change location to call swagger api docs from http://localhost:8081/swagger-ui.html
to 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 I use springfox-swagger2
and springfox-swagger-ui
both with version 2.7.0
.
If using Spring Boot, you can add a mapping to redirect the request like:
This is all I can did it.
This methods is added in a configuration class that extend
WebMvcConfigurerAdapter
like thatpublic class Configuration extends WebMvcConfigurerAdapter {...}
You can't remove
swagger-ui.html
or change because is hard-coded in source code.