This repository has been archived by the owner on Oct 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
FastJsonHttpMessageConverter_CN
VictorZeng edited this page Apr 28, 2016
·
2 revisions
FastJson 提供了Spring MVC HttpMessageConverter的实现
- FastJsonHttpMessageConverter for Spring MVC Below 4.2
- FastJsonHttpMessageConverter4 for Spring MVC 4.2+
可用于在Spring Controller中使用FastJson进行数据的Serialize and Deserialize
FastJsonConfig配置
<bean id="fastJsonConfig" class="com.alibaba.fastjson.support.config.FastJsonConfig">
<!-- Default charset -->
<property name="charset" value="UTF-8" />
<!-- Default dateFormat -->
<property name="dateFormat" value="yyyy-MM-dd HH:mm:ss" />
<!-- Feature -->
<property name="features">
<list>
<value>Your feature</value>
</list>
</property>
<!-- SerializerFeature -->
<property name="serializerFeatures">
<list>
<value>Your serializer feature</value>
</list>
</property>
<!-- Global SerializeFilter -->
<property name="serializeFilters">
<list>
<ref bean="Your serializer filter"/>
</list>
</property>
<!-- Class Level SerializeFilter -->
<property name="classSerializeFilters">
<map>
<entry key="Your filter class" value-ref="Your serializer filter"/>
</map>
</property>
</bean>
HttpMessageConverter配置
<mvc:annotation-driven>
<mvc:message-converters>
<bean class="com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter">
<!-- MediaTypes -->
<property name="supportedMediaTypes">
<list>
<value>application/json</value>
</list>
</property>
<!-- FastJsonConfig -->
<property name="fastJsonConfig" ref="fastJsonConfig" />
</bean>
</mvc:message-converters>
</mvc:annotation-driven>
<mvc:default-servlet-handler />
如有需要修改本注脚,请联系阿里巴巴,
© Alibaba Fastjson Develop Team
注明: 版权所有阿里巴巴,请注明版权所有者
If you need to amend this footnote, please contact Alibaba.
© Alibaba Fastjson Develop Team
Note: Copyright Alibaba, please indicate the copyright owner