在spring的配置文件xml中

 示例:

<!--注入枚举数組-->
<bean id="writeMapNullValue" class="org.springframework.beans.factory.config.FieldRetrievingFactoryBean">
    <property name="staticField" value="com.alibaba.fastjson.serializer.SerializerFeature.WriteMapNullValue" />
</bean>
<bean id="WriteNullStringAsEmpty" class="org.springframework.beans.factory.config.FieldRetrievingFactoryBean">
    <property name="staticField" value="com.alibaba.fastjson.serializer.SerializerFeature.WriteNullStringAsEmpty" />
</bean>
<bean id="fastJsonConfig" class="com.alibaba.fastjson.support.config.FastJsonConfig">
    <property name="charset" value="utf-8" />
    <property name="serializerFeatures" >
        <array>
            <ref bean="writeMapNullValue"/>
            <ref bean="WriteNullStringAsEmpty"/>
        </array>
    </property>
</bean>

 

相关文章:

  • 2021-12-11
  • 2021-12-10
  • 2021-09-26
  • 2022-12-23
  • 2021-10-10
  • 2021-07-13
  • 2021-11-07
  • 2022-12-23
猜你喜欢
  • 2022-02-24
  • 2021-07-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-04
相关资源
相似解决方案