Closed julyaTyrer closed 6 years ago
See below what worked for us:
@Configuration
@EnableSwagger2
public class SwaggerConfiguration {
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build().pathProvider(new RelativePathProvider(null) {
@Override
public String getApplicationBasePath() {
return "/";
}
});
}
}
This has nothing to do with swagger-tools
I'm afraid.
alexmoleiro you saved my week)))
Hi,
I'm trying to change base url for API documentation. The base url is "http://localhost:8080/swagger-ui.html". I want to get something like "http://localhost:8080/myapi/swagger-ui.html".
I use Springfox 2.8.0 Swagger, Java 8, Spring Boot 2.0 The swagger configuration is:
Custom path provider had to help, but I still get access to api documentation by using url "http://localhost:8080/swagger-ui.html". If I use url "http://localhost:8080/myapi/swagger-ui.html", I get 404 error. Please, help to change the code.