springboot集成swagger报404问题
@Configuration
@EnableSwagger2
public class SwaggerConfig extends WebMvcConfigurationSupport {
@Bean public Docket createRestApi() { return new Docket(DocumentationType.SWAGGER_2) .pathMapping("/") .select() // swagger要扫描的controller包 .apis(RequestHandlerSelectors.basePackage("fun.imcoder.cloud.controller")) .paths(PathSelectors.any()) .build().apiInfo(new ApiInfoBuilder() .title("springboot2.x集成swagger") .description("springboot2.x集成swagger") .version("1.0") .contact(new Contact("imcoder", "http://www.imcoder.fun", "imacoder@126.com")) .build()); } @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/"); } }
加入 addResourceHandlers 瞬间搞定。
热门文章
- 碳化炉设备(碳化炉设备清单表)
- 延吉市宠物医院推荐(延吉市宠物狗)
- 襄阳宠物救助中心地址(襄阳宠物救助中心地址查询)
- 动物疫苗注射注意事项有哪些呢英语(动物疫苗注射注意事项有哪些呢英语作文)
- 乍得VPN | 3月6日19.9M/S|免费SSR/Shadowrocket/Clash/V2ray免费节点订阅分享
- 开宠物用品店需要具备哪些条件(开宠物用品店怎么样)
- 成都宠物领养平台正规吗现在有哪些公司(成都宠物领养中心官网收容中心)
- 乍得VPN | 3月25日20.7M/S|免费V2ray/Clash/Shadowrocket/SSR免费节点订阅分享
- 乍得VPN | 3月13日20.4M/S|免费SSR/Shadowrocket/V2ray/Clash免费节点订阅分享
- 动物疫苗保质期几年(动物疫苗新规)