码迷,mamicode.com
首页 > 编程语言 > 详细

Spring 处理 fastjson MediaType.All 的情况

时间:2019-03-16 20:48:26      阅读:178      评论:0      收藏:0      [点我收藏+]

标签:set   color   sage   port   字节流   fas   使用   ati   spring   

 1     /**
 2          * fastJson 的MediaType.All的情况Spring默认会使用一个字节流,而不是识别成json,这里对它进行一下覆盖处理
 3          */
 4         public static class FastJsonHttpMessageConvert5 extends FastJsonHttpMessageConverter4 {
 5             static final Charset DEFAULT_CHAREST = Charset.forName("UTF-8");
 6             FastJsonHttpMessageConvert5(){
 7                 setDefaultCharset(DEFAULT_CHAREST);
 8                 setSupportedMediaTypes(Arrays.asList(MediaType.APPLICATION_JSON,new MediaType("application","*+json")));
 9             }
10         }

 

Spring 处理 fastjson MediaType.All 的情况

标签:set   color   sage   port   字节流   fas   使用   ati   spring   

原文地址:https://www.cnblogs.com/liamlee/p/10544219.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!