原因:访问knife4j需要静态资源,在拦截器中配置添加即可。
解决方案:
继承WebMvcConfigurationSupport类,重写addResourceHandlers()方法。
@Configuration
public class MvcConfigurerAdapter extends WebMvcConfigurationSupport {
@Override
protected void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("doc.html").addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
super.addResourceHandlers(registry);
}
}