SpringForAll / spring-boot-starter-swagger

自制spring boot starter for swagger 2.x,来试试吧,很好用哦~
Apache License 2.0
2.13k stars 522 forks source link

找不到swagger-ui.html #117

Open rainmanhhh opened 6 years ago

rainmanhhh commented 6 years ago

看日志只有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

liululee commented 5 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);
    }
}