|  |  | 
 |  |  | import org.springframework.boot.system.ApplicationHome; | 
 |  |  | import org.springframework.context.annotation.Bean; | 
 |  |  | 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 org.springframework.web.servlet.config.annotation.*; | 
 |  |  |  | 
 |  |  | import java.util.ArrayList; | 
 |  |  |  | 
 |  |  | 
 |  |  |         regisration.excludePathPatterns(excludePath);//设置不拦截路径 | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public void addCorsMappings(CorsRegistry registry) { | 
 |  |  |         registry.addMapping("/**") | 
 |  |  |                 //是否发送Cookie | 
 |  |  |                 .allowCredentials(true) | 
 |  |  |                 //放行哪些原始域 | 
 |  |  |                 .allowedOrigins("*") | 
 |  |  |                 .allowedMethods(new String[]{"GET", "POST", "PUT", "DELETE"}) | 
 |  |  |                 .allowedHeaders("*") | 
 |  |  |                 .exposedHeaders("*"); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 添加静态资源文件,外部可以直接访问地址 | 
 |  |  |      * |