I decided to update the version of Swagger and eventually ran into a problem.

I have a dependency:

<!-- ==== Swagger ==== --> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> <version>2.9.2</version> </dependency> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger-ui</artifactId> <version>2.9.2</version> </dependency> 

Config bin:

 import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.RequestHandlerSelectors; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.swagger2.annotations.EnableSwagger2; @Configuration @EnableSwagger2 public class SwaggerConfig { @Bean public Docket apiDocket() { return new Docket(DocumentationType.SWAGGER_2) .select() .apis(RequestHandlerSelectors.any()) .paths(PathSelectors.any()) .build(); } } 

I open the URL http://localhost:8080/swagger-ui.html and get 404 . At the same time, Swager itself analyzes endpoints:

 2019-01-06 21:20:52.921 INFO 29793 --- [ main] pertySourcedRequestMappingHandlerMapping : Mapped URL path [/v2/api-docs] onto method [public org.springframework.http.ResponseEntity<springfox.documentation.spring.web.json.Json> springfox.documentation.swagger2.web.Swagger2Controller.getDocumentation(java.lang.String,javax.servlet.http.HttpServletRequest)] 

PS: I checked other questions on this issue and their solution did not help me.

What could be the problem?

  • and what is the full path to html in project resources? - raviga 9:40 pm
  • Stop, so the path / v2 / api-docs is obviously zamaplen in your logs, is it boring to use it not? - GenCloud 9:44 pm
  • @GenGloud, does this have to do with the swagger-ui itself? It seemed to me - what is not - SlandShow
  • @Dima Khodan in the resources there is no application context, so to the swager I knock through lokalkhost - SlandShow

1 answer 1

The solution was found.

As it turned out, the Swagger UI dependency was simply not loaded by the maven.

The fact is that IDE did not use Maven, but was generated by mvnw , which already did not load the required dependency.

But the most interesting thing is that mvnw wrapper loaded the swagger-ui version of version 2.6.1 :

enter image description here

In summary, I did the following:

  1. Removed mvnw file
  2. completed mvn clean install
  3. Rebooted IDE

And the desired dependency is loaded:

enter image description here

For this reason, if you have a similar problem - just try to check if Maven is being used .