Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the path of swagger-ui in spring-mvc

How can I change the path of swagger-ui so that it is not loaded on / but at /docs/ The simple solution recommended in some blogs would be to unpack swagger-spring-mvc-ui sources in webapps dir. But I search for a elegant solution where the webjar swagger-spring-mvc-ui is a dependency like all others.

like image 972
Roland Kofler Avatar asked Nov 06 '14 17:11

Roland Kofler


1 Answers

Is there a reason why something like this doesn't work?

<!-- swagger api declaration -->
<servlet>
  <servlet-name>ApiDeclarationServlet</servlet-name>
  <servlet-class>com.wordnik.swagger.servlet.listing.ApiDeclarationServlet</servlet-class>
</servlet>
<servlet-mapping>
  <servlet-name>ApiDeclarationServlet</servlet-name>
  <url-pattern>/api-docs/*</url-pattern>
</servlet-mapping>
like image 54
stringy05 Avatar answered Sep 27 '22 21:09

stringy05