Spring 注入枚举数组

 在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>

 

posted @ 2019-01-16 11:52  phpdragon  阅读(569)  评论(0编辑  收藏  举报