首先这些是我的静态资源
在resources/static下
SpringBoot自定义MvcConfig现在是需要继承WebMvcConfigurer(官方推荐)
所以在继承了这个接口的类中
实现addInterceptors 方法
在插入自定义的拦截方法之后
选择excudePathPatterns中
把这些路径都加入
public void addInterceptors(InterceptorRegistry registry) {
//所有都进行拦截 但排除toLogin这个路径
//直接在这把静态资源的给排除掉就行了
registry.addInterceptor(new MyInterceptor()).addPathPatterns("/**").excludePathPatterns("/toLogin","/login","/css/**","/js/**","/images/**","/fonts/**");
}