|  |  | 
 |  |  | import org.springframework.context.annotation.Configuration; | 
 |  |  | import org.springframework.web.servlet.config.annotation.InterceptorRegistration; | 
 |  |  | import org.springframework.web.servlet.config.annotation.InterceptorRegistry; | 
 |  |  | import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; | 
 |  |  | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | 
 |  |  |  | 
 |  |  | import java.util.ArrayList; | 
 |  |  | 
 |  |  |         regisration.addPathPatterns("/**/**");//设置拦截路径 | 
 |  |  |         regisration.excludePathPatterns(excludePath);//设置不拦截路径 | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 添加静态资源文件,外部可以直接访问地址 | 
 |  |  |      * | 
 |  |  |      * @param registry | 
 |  |  |      */ | 
 |  |  |     @Override | 
 |  |  |     public void addResourceHandlers(ResourceHandlerRegistry registry) { | 
 |  |  |         try { | 
 |  |  |             registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/"); | 
 |  |  |         } catch (Exception e) { | 
 |  |  |             e.printStackTrace(); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |     } | 
 |  |  | } |