Springfox: How can we change the swagger-ui access URL?

Created on 21 Jul 2016  路  3Comments  路  Source: springfox/springfox

I have a issue changing the Swagger-Ui URL. I integrated swager2 and swagger-ui using below dependencies in my project and using DOCKET to get all apis


io.springfox
springfox-swagger2
2.4.0

    <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-swagger-ui</artifactId>
        <version>2.4.0</version>
    </dependency>

Right now i am able to access to swagger Ui using : http://localhost:8080//rest/swagger-ui.html

So i want to change that URL to : http://localhost:8080/swagger or http://localhost:8080//swagger.

Can any one help me with this.

question

All 3 comments

Have you read the docs? There are notes on how to do this. also please use 2.5.0

@dilipkrish I went through it, and tried to do below modifications.

@Bean
UiConfiguration uiConfig() {
return new UiConfiguration(
"http://localhost:8080/swagger",
"none",
"alpha",
"schema",
UiConfiguration.Constants.DEFAULT_SUBMIT_METHODS,
false,
true);
}

But it didn't work for me. I am new to swagger so, can you please tell what i need to change?
Thanks

Where is the document does it say how to change the path to the swagger-ui.html?
I see this:

Since swagger ui is a static resource it needs to rely on known endpoints to configure itself at runtime. So these 鈽濓笍 are *cool uris that cannot change. There is some customization that is possible, but swagger-ui needs to be available at the root of the webcontext.

so is it not possible to make it be in a different folder than the root of the web context? I want it one level deeper than the webcontext.

Was this page helpful?
0 / 5 - 0 ratings