title: Swagger with Spring Boot 2.0 leads to 404 error page
body: <p>I'm trying to integrate my Spring Boot version  <code>2.0.1.RELEASE</code> with <a href="https://swagger.io/" rel="nofollow noreferrer">Swagger</a>.</p>
  <p>From this <a href="http://www.baeldung.com/swagger-2-documentation-for-spring-rest-api" rel="nofollow noreferrer">blog post</a>  it seemed like it will be easy by just adding two Maven dependencies and everything should work.</p>
  <p>So I added the following dependencies to the pom:</p>
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;io.springfox&lt;/groupId&gt;
      &lt;artifactId&gt;springfox-swagger2&lt;/artifactId&gt;
      &lt;version&gt;2.8.0&lt;/version&gt;
  &lt;/dependency&gt;
  
  &lt;dependency&gt;
      &lt;groupId&gt;io.springfox&lt;/groupId&gt;
      &lt;artifactId&gt;springfox-swagger-ui&lt;/artifactId&gt;
      &lt;version&gt;2.8.0&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  <p>And created the <code>SwaggerConfig</code> bean:</p>
  <pre class="lang-java prettyprint-override"><code>@Configuration
  @EnableSwagger2
  public class SwaggerConfig {
      @Bean
      public Docket api() {
          Docket docket = new Docket(DocumentationType.SWAGGER_2)
                  .select()
                  .apis(RequestHandlerSelectors.any())
                  .paths(PathSelectors.any())
                  .build();
          return docket;
      }
  }
  </code></pre>
  <p>And in the properties file I ended up with these 3 entries during the attempts to make it work:</p>
  <pre class="lang-yaml prettyprint-override"><code>spring.application.name=cat-service
  management.server.servlet.context-path=/cat-service
  server.servlet.contextPath=/cat-service
  </code></pre>
  <p>But at the end, when accessing</p>
  <p><code>http://localhost:8080/cat-service/api/v2/api-docs</code></p>
  <p>or the UI page at</p>
  <p><code>http://localhost:8080/cat-service/swagger-ui.html</code></p>
  <p>I get  a <code>page not found</code> error.</p>
  <p>I found <a href="https://github.com/springfox/springfox/issues/2155" rel="nofollow noreferrer">this issues in the swagger github page</a>  and <a href="https://stackoverflow.com/questions/49586658/spring-boot-2-0-with-swagger-ui-not-working-properly">this question in stackoverflow</a>  but I was not able to change my <code>404</code> error.</p>