配置Fastjson解析器,这里使用注解开发,在springmvc配置文件中添加
阿里巴巴的fastJson,这个号称是目前最快的json解析工具,而且就一个jar包,很方便!
fastjson
- <mvc:annotation-driven >
- <mvc:message-converters register-defaults=“true”>
- <!– 配置Fastjson支持 –>
- <bean class=“com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter”>
- <property name=“supportedMediaTypes”>
- <list>
- <value>text/html;charset=UTF-8</value>
- <value>application/json</value>
- </list>
- </property>
- <property name=“features”>
- <list>
- <value>WriteMapNullValue</value>
- <value>QuoteFieldNames</value>
- </list>
- </property>
- </bean>
- </mvc:message-converters>
- </mvc:annotation-driven>
- <!– 使用注解时一定要配置注解扫描 –>
- <context:component-scan base-package=“cc.javar.controler” />
未经允许不得转载:Java爱好者 » 配置Fastjson解析器