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萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章