1

I just added Swagger to my web application but when I display the UI the location url shows this:

http://localhost:8080${pageContext.request.contextPath}/api-docs

I had a look to Unable to get Swagger UI working with Spring boot and Not getting things working with Spring Boot and added the tomcat-embed-jasper dependency as suggested

<dependency>
    <groupId>org.apache.tomcat.embed</groupId>
    <artifactId>tomcat-embed-jasper</artifactId>
    <scope>provided</scope>
</dependency>

but I can still see the ${pageContext.request.contextPath} in the url. I am using version 1.0.2 of swagger-springmvc and version 0.4 of swagger-spring-mvc-ui

    <dependency>
        <groupId>com.mangofactory</groupId>
        <artifactId>swagger-springmvc</artifactId>
        <version>1.0.2</version>
    </dependency>
    <dependency>
        <groupId>org.ajar</groupId>
        <artifactId>swagger-spring-mvc-ui</artifactId>
        <version>0.4</version>
    </dependency>

Any help or suggestion on how to solve this will be much appreciated.

Community
  • 1
  • 1
Eduardo Sanchez-Ros
  • 1,777
  • 2
  • 18
  • 30
  • 1
    Have you looked at [this issue](https://github.com/springfox/springfox/issues/496)? Also I think you should upgrade to 2.x of springfox. – Dilip Krishnan Sep 27 '15 at 02:42
  • I did, but it did not work. I will try springfox but I have the feeling that I am missing something obvious. Thanks @DilipKrishnan – Eduardo Sanchez-Ros Sep 27 '15 at 18:55
  • 1
    If moving to 2.x isn't an option you could manually copy swagger-ui to your resources folder and configure it [similar to this](https://github.com/springfox/springfox-demos/blob/master/spring-java-swagger/src/main/java/springfoxdemo/java/swagger/SpringConfig.java). There is nothing magical about the web jar solution that comes out of the box. – Dilip Krishnan Sep 27 '15 at 22:30
  • @DilipKrishnan Thanks for the suggestion. I moved to 2.x of springfox and it worked out of the box. – Eduardo Sanchez-Ros Sep 28 '15 at 09:50

0 Answers0