配置Fastjson解析器,这里使用注解开发,在springmvc配置文件中添加
阿里巴巴的fastJson,这个号称是目前最快的json解析工具,而且就一个jar包,很方便!
https://repo1.maven.org/maven2/com/alibaba/fastjson/1.2.9/
Maven
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.76</version>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.1.72.android</version>
- <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" />