<mvc:annotation-driven> <mvc:message-converters> <bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"> <property name="objectMapper"> <bean class="com.fasterxml.jackson.databind.ObjectMapper"> <!-- 处理responseBody 里面日期类型 --> <!-- <property name="dateFormat"> <bean class="java.text.SimpleDateFormat"> <constructor-arg type="java.lang.String" value="yyyy-MM-dd HH:mm:ss" /> </bean> </property> --> <!-- 为null字段时不显示 --> <property name="serializationInclusion"> <value type="com.fasterxml.jackson.annotation.JsonInclude.Include">NON_NULL</value> </property> <property name="propertyNamingStrategy"> <!--<bean class="com.xxx.serializer.MyPropertyNamingStrategyBase" />--> <bean class="com.fasterxml.jackson.databind.PropertyNamingStrategy.LowerCaseWithUnderscoresStrategy" /> </property> </bean> </property> <property name="supportedMediaTypes"> <list> <value>text/html;charset=UTF-8</value> <value>application/json; charset=UTF-8</value> </list> </property> </bean> </mvc:message-converters> </mvc:annotation-driven>
MappingJackson2HttpMessageConverter
最新推荐文章于 2024-06-27 15:33:08 发布