Spring 处理 fastjson MediaType.All 的情况

 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         }

 

posted @ 2019-03-16 20:36  木子李lee  阅读(1200)  评论(0编辑  收藏  举报