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.
Asked
Active
Viewed 3,083 times
1
-
which swagger implementation you are using ? .. Try to hit url as http://localhost:8080/swagger-ui.html – abhi3232 Mar 31 '18 at 10:21
-
Please add more info: do you use springfox, do you have an existing controllers or will using codegen, do you have a Oauth or another security configured with your SpringBoot? – Georgi Stoyanov Apr 03 '18 at 20:24
-
If you can also post what your application.properties looks like. I ran into the same issue where all my configurations and swagger documentation end points are working until I specify **spring.resources.static-locations[0]=file:src/main/resources/static/** and **spring.resources.static-locations[1]=classpath:/static/** – olyjosh Jun 04 '18 at 10:37
2 Answers
1
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/");
}
}

sarah
- 580
- 1
- 6
- 24
0
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

Siddharth Sachdeva
- 1,812
- 1
- 20
- 29