spring框架把返回对象中的null转换成空字符串的配置

来源:互联网 发布:pta编程7-1 编辑:程序博客网 时间:2024/05/21 10:50
<mvc:annotation-driven enable-matrix-variables="true">    <mvc:message-converters register-defaults="true">      <bean class="com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter">        <property name="supportedMediaTypes">          <list>            <value>text/html;charset=UTF-8</value>            <value>application/json</value>            <value>application/x-www-form-urlencoded</value>            <value>text/plain</value>          </list>        </property>        <property name="features">          <list>              <value>WriteMapNullValue</value>              <value>QuoteFieldNames</value>              <value>WriteNullStringAsEmpty</value>          </list>      </property>      <property name="dateFormat" value="yyyy-MM-dd HH:mm:ss"/>      </bean>    </mvc:message-converters>  </mvc:annotation-driven>

重点是这句:WriteNullStringAsEmpty

阅读全文
0 0
原创粉丝点击