Reputation: 455
I am trying to integrate Spring Boot 2.0 with swagger but not showing up end points.When I looked to developer console on network tab ,it says that I couldn't find "http://localhost:8080/swagger-resources/configuration/ui" and return 404.
Upvotes: 1
Views: 3356
Reputation: 620
We solved this problem by adding resource handler for swagger:
Example:
@Configuration
public class MvcConfiguration extends WebMvcConfigurationSupport {
@Value("${spring.application.name}")
private String applicationName;
//...irrelevant code here
@Override
protected void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("swagger-ui.html")
.addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**")
.addResourceLocations("classpath:/META-INF/resources/webjars/");
}
}
Upvotes: 1
Reputation: 1906
If you have @EnableWebMvc or @WebMvcConfigurationSupport annotation anywhere in the project then remove these or add custom resource handlers to configure swagger-ui.
Here's some common solutions: https://github.com/springfox/springfox/issues/2396#issuecomment-402150402
Upvotes: 0