springmvc 过滤 不返回值为NULL的数据

</pre><pre name="code" class="html">  <mvc:annotation-driven>
    	<mvc:message-converters register-defaults="true">
	        <bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
	            <property name="objectMapper">
	                <bean class="com.fasterxml.jackson.databind.ObjectMapper">
	                    <property name="serializationInclusion">
	                        <value type="com.fasterxml.jackson.annotation.JsonInclude.Include">NON_NULL</value>
	                    </property>
	                </bean>
	            </property>
	        </bean>
	    </mvc:message-converters> 
    </mvc:annotation-driven>

配置文件里的<mvc: annotation-driven>  标签如上写,返回的json数据,若值为NULL ,该值会不显示

发布了76 篇原创文章 · 获赞 15 · 访问量 19万+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章