|
|
|
|
@ -1,6 +1,7 @@ |
|
|
|
|
package net.mingsoft.config; |
|
|
|
|
|
|
|
|
|
import java.io.File; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.regex.Matcher; |
|
|
|
|
import java.util.regex.Pattern; |
|
|
|
|
|
|
|
|
|
@ -15,6 +16,8 @@ import org.springframework.boot.web.servlet.ServletRegistrationBean; |
|
|
|
|
import org.springframework.context.annotation.Bean; |
|
|
|
|
import org.springframework.context.annotation.Configuration; |
|
|
|
|
import org.springframework.core.Ordered; |
|
|
|
|
import org.springframework.http.converter.HttpMessageConverter; |
|
|
|
|
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; |
|
|
|
|
import org.springframework.web.context.request.RequestContextListener; |
|
|
|
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; |
|
|
|
|
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer; |
|
|
|
|
@ -27,6 +30,8 @@ import com.alibaba.druid.support.http.StatViewServlet; |
|
|
|
|
import com.alibaba.druid.support.http.WebStatFilter; |
|
|
|
|
import com.alibaba.druid.support.spring.stat.BeanTypeAutoProxyCreator; |
|
|
|
|
import com.alibaba.druid.support.spring.stat.DruidStatInterceptor; |
|
|
|
|
import com.fasterxml.jackson.databind.DeserializationFeature; |
|
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper; |
|
|
|
|
|
|
|
|
|
import net.mingsoft.basic.interceptor.ActionInterceptor; |
|
|
|
|
import net.mingsoft.basic.util.BasicUtil; |
|
|
|
|
@ -117,4 +122,26 @@ public class WebConfig implements WebMvcConfigurer { |
|
|
|
|
registry.setOrder(Ordered.HIGHEST_PRECEDENCE); |
|
|
|
|
WebMvcConfigurer.super.addViewControllers(registry); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 解决com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException 问题,提交实体不存在的字段异常 |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) { |
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
WebMvcConfigurer.super.configureMessageConverters(converters); |
|
|
|
|
converters.add(mappingJackson2HttpMessageConverter()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
public MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter(){ |
|
|
|
|
MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(); |
|
|
|
|
ObjectMapper objectMapper = new ObjectMapper(); |
|
|
|
|
//添加此配置
|
|
|
|
|
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); |
|
|
|
|
converter.setObjectMapper(objectMapper); |
|
|
|
|
return converter; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|