I have a microservice developed using Spring Boot 2.1.3 version and also I have used SpringFox version 2.9.2 for Swagger documentation. Every time when I distribute or deploy to third party or any other person, I have to always mention the swagger url for the user to go through the REST end-points. My question is how to make a default redirected url in case of spring boot so that it should redirect to swagger-ui.html automatically. It means if the user types http://localhost:8080 in the browser, the browser should automatically redirect to the url ie. http://localhost:8080/api/swagger-ui.html. I want to know is there any configuration required for this ?
Before reaching to stackoverflow, I have gone through the following links and tried, but nothing worked as expected.
Java Spring Boot: How to map my app root (“/”) to index.html?
Changing default welcome-page for spring-boot application deployed as a war
I tried different ways also, but I always get 404 or Whitelabel Error Page. I want to know is there any way in case whitelabel error page it should automatically redirect to swagger page ie. http://localhost:8080/api/swagger-ui.html.
I have also added the below in application.properties.
server.servlet.context-path=/api
Please help me in this regard.