title: Need to update swagger UI Path for spring boot project
body: <p>I am having a spring boot project and need to update my swagger path from</p>
  <pre><code>http://localhost:9012/swagger-ui.html to http://localhost:9012/myservice/swagger-ui.html
  </code></pre>
  <p>I am not using any context path for my application I have tried all the below approach but none of them worked.</p>
  <p><a href="https://stackoverflow.com/questions/46180375/change-location-to-call-swagger-ui-in-spring">Change location to call swagger-ui in Spring</a></p>
  <p><a href="https://github.com/springfox/springfox/issues/1443" rel="nofollow noreferrer">https://github.com/springfox/springfox/issues/1443</a></p>
  <p><a href="https://stackoverflow.com/questions/57193286/how-to-change-swagger-ui-html-default-path">How to change swagger-ui.html default path</a></p>
  <p><a href="https://github.com/springfox/springfox/issues/1080" rel="nofollow noreferrer">https://github.com/springfox/springfox/issues/1080</a></p>
  <p><a href="https://stackoverflow.com/questions/50712519/how-to-change-swagger-ui-url-prefix">How to change Swagger-ui URL prefix?</a></p>
  <pre><code>private static final String PATH = &quot;/myservice&quot;;
  
    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
      final String apiDocs = &quot;/v2/api-docs&quot;;
      final String configUi = &quot;/swagger-resources/configuration/ui&quot;;
      final String configSecurity = &quot;/swagger-resources/configuration/security&quot;;
      final String resources = &quot;/swagger-resources&quot;;
      final String swaggerUI = &quot;/swagger-ui.html&quot;;
  
      registry.addRedirectViewController(apiDocs, PATH +apiDocs).setKeepQueryParams(true);
      registry.addRedirectViewController(resources, PATH +resources);
      registry.addRedirectViewController(configUi, PATH +configUi);
      registry.addRedirectViewController(configSecurity, PATH +configSecurity);
      registry.addRedirectViewController(swaggerUI, PATH + swaggerUI);
      registry.addRedirectViewController(&quot;/&quot;,PATH);
    }
  
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry){
      registry.addResourceHandler(PATH + &quot;/swagger-ui.html**&quot;).addResourceLocations(&quot;classpath:/META-INF/resources/swagger-ui.html&quot;);
      registry.addResourceHandler(PATH + &quot;/webjars/**&quot;).addResourceLocations(&quot;classpath:/META-INF/resources/webjars/&quot;);
    }
  </code></pre>
  <p>I am using swagger version 2.9.2
  Is there any other way to resolve the issue.</p>