|
|
|
@ -3,14 +3,16 @@ package ${basePackage}.config;
|
|
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
|
|
import com.fasterxml.jackson.databind.module.SimpleModule;
|
|
|
|
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
|
import org.springframework.core.env.Environment;
|
|
|
|
|
import org.springframework.http.converter.HttpMessageConverter;
|
|
|
|
|
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
|
|
|
|
import org.springframework.util.AntPathMatcher;
|
|
|
|
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
|
|
|
|
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
|
|
|
|
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|
|
|
|
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
|
|
|
|
import ${basePackage}.frame.auth.LocalData;
|
|
|
|
|
import ${basePackage}.frame.utils.LogUtil;
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
@ -19,6 +21,20 @@ import java.util.List;
|
|
|
|
|
|
|
|
|
|
@Configuration
|
|
|
|
|
public class WebMvcConfig implements WebMvcConfigurer {
|
|
|
|
|
@Autowired
|
|
|
|
|
private Environment environment;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 设置忽略路径大小写
|
|
|
|
|
*
|
|
|
|
|
* @param configurer
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public void configurePathMatch(PathMatchConfigurer configurer) {
|
|
|
|
|
AntPathMatcher matcher = new AntPathMatcher();
|
|
|
|
|
matcher.setCaseSensitive(false);
|
|
|
|
|
configurer.setPathMatcher(matcher);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 增加全局拦截器,可用于异常日志的收集
|
|
|
|
@ -39,7 +55,7 @@ public class WebMvcConfig implements WebMvcConfigurer {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}).addPathPatterns("/**").excludePathPatterns(LocalData.getProp("spring.mvc.static-path-pattern"));
|
|
|
|
|
}).addPathPatterns("/**").excludePathPatterns(environment.getProperty("spring.mvc.static-path-pattern"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|