Open rainmanhhh opened 6 years ago
可能是地址映射的问题,如果扩展了WebMvcConfigurationSupport , 可以参照以下写法:
@Configuration
public class WebMvcConfig extends WebMvcConfigurationSupport {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/**").addResourceLocations("classpath:/static/");
registry.addResourceHandler("swagger-ui.html")
.addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**")
.addResourceLocations("classpath:/META-INF/resources/webjars/");
super.addResourceHandlers(registry);
}
}
看日志只有api-docs和以下几个swagger相关的mapping被执行了 Mapped "{[/swagger-resources/configuration/ui]}" onto public org.springframework.http.ResponseEntity springfox.documentation.swagger.web.ApiResourceController.uiConfiguration()
Mapped "{[/swagger-resources]}" onto public org.springframework.http.ResponseEntity<java.util.List> springfox.documentation.swagger.web.ApiResourceController.swaggerResources()
Mapped "{[/swagger-resources/configuration/security]}" o