| | |
| | | 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; |
| | |
| | | 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 |
| | |
| | | } |
| | | |
| | | @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("*") |