springmvcfastJsonfeaturesDeprecated

star2017 1年前 ⋅ 565 阅读

项目中fastjson版本升级到1.2.23时,发现FastJsonHttpMessageConverter配置中features的属性已经过期了,虽然不影响使用,但是不知道什么时候就会不能用了,所有还是要修改的。
FastJsonHttpMessageConverter使用了fastJsonConfig属性。

代码示例:

<mvc:annotation-driven>
		<mvc:message-converters>
			<bean class="org.springframework.http.converter.StringHttpMessageConverter">
				<constructor-arg value="UTF-8"/>
			</bean>
			<bean class="com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter">
				<property name="supportedMediaTypes">
					<list>
						<value>text/html;charset=UTF-8</value>
						<value>application/json;charset=UTF-8</value>
					</list>
				</property>
				<property name="fastJsonConfig" ref="fastJsonConfig" />
			</bean>
		</mvc:message-converters>
	</mvc:annotation-driven>
	<bean id="fastJsonConfig" class="com.alibaba.fastjson.support.config.FastJsonConfig">
		<property name="charset" value="UTF-8" />
	</bean>

如有写的不对的地方,请大家指出来。

再次感谢大家耐心的看完我的博客。希望对你有帮助。


本文为博主原创文章,未经博主允许不得转载。
更多内容请访问:IT源点

相关文章推荐

全部评论: 0

    我有话说: