zjj
昨天 da20b84fb1dbb266939deff9fd52f9a16f4e32fa
rsf-server/src/main/java/com/vincent/rsf/server/common/config/WebMvcConfig.java
@@ -1,12 +1,14 @@
package com.vincent.rsf.server.common.config;
import com.vincent.rsf.server.common.constant.Constants;
import com.vincent.rsf.server.common.interceptor.severlet.DynamicFieldsInterceptor;
import com.vincent.rsf.server.common.utils.Http;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.AsyncHandlerInterceptor;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
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.servlet.http.HttpServletRequest;
@@ -25,7 +27,22 @@
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(getAsyncHandlerInterceptor())
                .addPathPatterns("/**")
        ;
                .excludePathPatterns("/swagger-resources/**", "/webjars/**","/erp/**", "/v2/**","/v3/**","/doc.html/**", "/swagger-ui.html/**");
        registry.addInterceptor(dynamicFieldsInterceptor())
                .addPathPatterns("/**")
                .excludePathPatterns("/swagger-resources/**",
                        "/webjars/**",
                        "/erp/**",
                        "/v2/**",
                        "/v3/**",
                        "/doc.html/**",
                        "/swagger-ui.html/**");
    }
    @Bean
    public DynamicFieldsInterceptor dynamicFieldsInterceptor() {
        return new DynamicFieldsInterceptor();
    }
    @Bean
@@ -40,6 +57,18 @@
    }
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/**").addResourceLocations("classpath:/static/");
        registry.addResourceHandler("swagger-ui.html")
                .addResourceLocations("classpath:/META-INF/resources/");
        registry.addResourceHandler("doc.html")
                .addResourceLocations("classpath:/META-INF/resources/");
        registry.addResourceHandler("/webjars/**")
                .addResourceLocations("classpath:/META-INF/resources/webjars/");
    }
    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**")
                .allowedOriginPatterns("*")