I wanna change my swagger-ui path from localhost:8080/swagger-ui.html
to
localhost:8080/myapi/swagger-ui.html
in springboot
redirect is helpless to me
You can change default swagger-ui path programmatically using ApplicationListener<ApplicationPreparedEvent> . The idea is simple - override springdoc. swagger-ui. path=/custom/path before your Spring Boot application starts.
Generating HTML documentation using Swagger-ui. This will be located at localhost:8080/swagger-ui. html. Swagger will display the API endpoints which you have configured it to generate documentation for.
http://localhost:8080/your-app-root/swagger-ui/ In our case, by the way, the exact URL will be: http://localhost:8080/spring-security-rest/api/swagger-ui/
In the application.properties of Spring Boot
springdoc.swagger-ui.path=/swagger-ui-custom.html
in your case it will be
springdoc.swagger-ui.path=/myapi/swagger-ui.html
You can modify springfox properties in application.properties
For example, to edit the base-url
springfox.documentation.swagger-ui.base-url=documentation
For e.g. setting it to /documentation
will put swagger-ui at /documentation/swagger-ui/index.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With