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>

猜你喜欢

转载自www.cnblogs.com/phpdragon/p/10276239.html
今日推荐