content: package cn.xeblog.xechat.config;
  
  import cn.xeblog.xechat.interceptor.PermissionInterceptor;
  import org.springframework.context.annotation.Configuration;
  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 javax.annotation.Resource;
  
  /**
   * mvc配置
   *
   * @author yanpanyi
   * @date 2019/03/27
   */
  @Configuration
  public class WebMvcConfig implements WebMvcConfigurer {
  
      @Resource
      private FileConfig fileConfig;
      @Resource
      private PermissionInterceptor permissionInterceptor;
  
      @Override
      public void addResourceHandlers(ResourceHandlerRegistry registry) {
          registry.addResourceHandler(fileConfig.getStaticAccessPath())
                  .addResourceLocations("classpath:/META-INF/resources/", "classpath:/resources/", "classpath:/static/",
                          "file:" + fileConfig.getDirectoryMapping());
      }
  
      @Override
      public void addInterceptors(InterceptorRegistry registry) {
          registry.addInterceptor(permissionInterceptor).addPathPatterns("/api/record/**", "/chatrecord/**");
      }
  
  }
  