|
|
@ -1,7 +1,10 @@ |
|
|
|
package com.qs.serve.common.config; |
|
|
|
|
|
|
|
import com.qs.serve.common.config.properties.ProjectProperties; |
|
|
|
import com.qs.serve.common.framework.interceptor.LimitSubmitInterceptor; |
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
import org.springframework.context.annotation.Bean; |
|
|
|
import org.springframework.context.annotation.Configuration; |
|
|
|
import org.springframework.web.cors.CorsConfiguration; |
|
|
@ -10,12 +13,14 @@ import org.springframework.web.filter.CorsFilter; |
|
|
|
import org.springframework.web.multipart.MultipartResolver; |
|
|
|
import org.springframework.web.multipart.commons.CommonsMultipartResolver; |
|
|
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; |
|
|
|
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; |
|
|
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; |
|
|
|
|
|
|
|
/** |
|
|
|
* @author YenHex |
|
|
|
* @since 2022/2/24 |
|
|
|
*/ |
|
|
|
@Slf4j |
|
|
|
@AllArgsConstructor |
|
|
|
@Configuration(proxyBeanMethods = false) |
|
|
|
public class SpringMvcConfig implements WebMvcConfigurer { |
|
|
@ -23,21 +28,22 @@ public class SpringMvcConfig implements WebMvcConfigurer { |
|
|
|
private final LimitSubmitInterceptor limitSubmitInterceptor; |
|
|
|
//private final ApiAuthInterceptor apiAuthInterceptor;
|
|
|
|
|
|
|
|
private final ProjectProperties projectProperties; |
|
|
|
|
|
|
|
@Override |
|
|
|
public void addInterceptors(InterceptorRegistry registry) { |
|
|
|
//注册LimitSubmitInterceptor拦截器
|
|
|
|
// registry.addInterceptor(apiAuthInterceptor)
|
|
|
|
// .addPathPatterns("/api/**")
|
|
|
|
// .excludePathPatterns("/api/wx/login/*","/api/dev/**");
|
|
|
|
registry.addInterceptor(limitSubmitInterceptor) |
|
|
|
.addPathPatterns("/**"); |
|
|
|
} |
|
|
|
|
|
|
|
/*@Override |
|
|
|
@Override |
|
|
|
public void addResourceHandlers(ResourceHandlerRegistry registry) { |
|
|
|
log.warn("PcWebLocal==>{}",projectProperties.getPcWebLocal()); |
|
|
|
registry.addResourceHandler("/web/**") |
|
|
|
.addResourceLocations("file:"+projectProperties.getPcWebLocal()); |
|
|
|
registry.addResourceHandler("/static/**") |
|
|
|
.addResourceLocations("classpath:/static/"); |
|
|
|
}*/ |
|
|
|
.addResourceLocations("file:"+projectProperties.getPcWebLocal()+"static/"); |
|
|
|
} |
|
|
|
|
|
|
|
@Bean |
|
|
|
public CorsFilter corsFilter() { |
|
|
|