|
|
|
@@ -1,5 +1,6 @@ |
|
|
|
package com.iformall.config; |
|
|
|
|
|
|
|
import com.fasterxml.jackson.annotation.JsonInclude; |
|
|
|
import com.fasterxml.jackson.databind.DeserializationConfig; |
|
|
|
import com.fasterxml.jackson.databind.DeserializationFeature; |
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper; |
|
|
|
@@ -9,6 +10,7 @@ import org.springframework.context.annotation.Configuration; |
|
|
|
import org.springframework.http.converter.HttpMessageConverter; |
|
|
|
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; |
|
|
|
import org.springframework.web.servlet.config.annotation.EnableWebMvc; |
|
|
|
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; |
|
|
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; |
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
@@ -19,6 +21,17 @@ import java.util.List; |
|
|
|
@Configuration |
|
|
|
@EnableWebMvc |
|
|
|
public class WebConfig implements WebMvcConfigurer { |
|
|
|
|
|
|
|
@Override |
|
|
|
public void addResourceHandlers(ResourceHandlerRegistry registry) { |
|
|
|
registry.addResourceHandler("swagger-ui.html") |
|
|
|
.addResourceLocations("classpath:/META-INF/resources/"); |
|
|
|
registry.addResourceHandler("/webjars/**") |
|
|
|
.addResourceLocations("classpath:/META-INF/resources/webjars/"); |
|
|
|
//registry.addResourceHandler("/app/**").addResourceLocations("classpath:/app/"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) { |
|
|
|
MappingJackson2HttpMessageConverter jackson2HttpMessageConverter = new MappingJackson2HttpMessageConverter(); |
|
|
|
@@ -26,6 +39,9 @@ public class WebConfig implements WebMvcConfigurer { |
|
|
|
ObjectMapper objectMapper = new ObjectMapper(); |
|
|
|
SimpleModule simpleModule = new SimpleModule(); |
|
|
|
|
|
|
|
//不显示为null的字段 |
|
|
|
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); |
|
|
|
|
|
|
|
DeserializationConfig dc = objectMapper.getDeserializationConfig(); |
|
|
|
// 设置反序列化日期格式、忽略不存在get、set的属性 |
|
|
|
objectMapper.setConfig( |
|
|
|
|