赞
踩
1. 代码层面,springboot不拦截静态资源需配置:
- import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
- import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
-
- public class WebMvcConfig implements WebMvcConfigurer{
-
- /**
- * 目前是解决的是swagger和微信授权文件无法被搜索到的问题
- * @author Nanci
- */
- @Override
- public void addResourceHandlers(ResourceHandlerRegistry registry) {
- // 解决 swagger-ui.html 404报错
- registry.addResourceHandler("/swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
- // 解决 doc.html 404 报错
- registry.addResourceHandler("/doc.html").addResourceLocations("classpath:/META-INF/resources/");
- registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
- registry.addResourceHandler("/swagger/**").addResourceLocations("classpath:/s
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。