Java Code Examples for com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter#setFastJsonConfig()

The following examples show how to use com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter#setFastJsonConfig() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CustomMVCConfiguration.java    From spring-boot-starter-netty with GNU General Public License v3.0 6 votes vote down vote up
@Bean
FastJsonHttpMessageConverter getFastJsonConv() {
    FastJsonHttpMessageConverter conv = new FastJsonHttpMessageConverter();

    FastJsonConfig oFastJsonConfig = new FastJsonConfig();
    oFastJsonConfig.setSerializerFeatures(
            SerializerFeature.WriteMapNullValue,
            SerializerFeature.WriteDateUseDateFormat
    );
    conv.setFastJsonConfig(oFastJsonConfig);

    List<MediaType> types = new ArrayList<>();
    types.add(MediaType.APPLICATION_JSON_UTF8);
    types.add(MediaType.APPLICATION_JSON);
    conv.setSupportedMediaTypes(types);
    return conv;
}
 
Example 2
Source File: WebMvcConfig.java    From yue-library with Apache License 2.0 6 votes vote down vote up
/**
 * <p>使用FastJson优先于默认的Jackson做json解析
 * <p>https://github.com/alibaba/fastjson/wiki/%E5%9C%A8-Spring-%E4%B8%AD%E9%9B%86%E6%88%90-Fastjson
 */
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
	// 1. 确认是否启用FastJsonHttpMessageConverter
	if (!webProperties.isEnabledFastJsonHttpMessageConverter()) {
		return;
	}
	
	// 2. 配置FastJsonHttpMessageConverter
	FastJsonHttpMessageConverter converter = new FastJsonHttpMessageConverter();
	FastJsonConfig config = new FastJsonConfig();
	config.setDateFormat(JSON.DEFFAULT_DATE_FORMAT);
	config.setSerializerFeatures(
			SerializerFeature.PrettyFormat, 
			SerializerFeature.BrowserCompatible, 
			SerializerFeature.WriteMapNullValue, 
			SerializerFeature.WriteNullBooleanAsFalse,
			SerializerFeature.WriteNullListAsEmpty, 
			SerializerFeature.WriteNullNumberAsZero,
			SerializerFeature.WriteNullStringAsEmpty
	);
	converter.setFastJsonConfig(config);
	converters.add(0, converter);
	
	log.info("【初始化配置-FastJsonHttpMessageConverter】默认配置为false,当前环境为true:使用FastJson优先于默认的Jackson做json解析 ... 已初始化完毕。");
}
 
Example 3
Source File: HttpBasicAuthConfig.java    From xmfcn-spring-cloud with Apache License 2.0 6 votes vote down vote up
/**
 * 替换springMVC JSON格式化工具为FastJSON,同时支持输出value=null的字段
 *
 * @return http message converters
 */
@Bean
public HttpMessageConverters fastJsonHttpMessageConverters(){
    //1.需要定义一个convert转换消息的对象;
    FastJsonHttpMessageConverter fastJsonHttpMessageConverter = new FastJsonHttpMessageConverter();
    //2:添加fastJson的配置信息;
    FastJsonConfig fastJsonConfig = new FastJsonConfig();
    fastJsonConfig.setSerializerFeatures(SerializerFeature.WriteMapNullValue);
    fastJsonConfig.setSerializeFilters();
    //3处理中文乱码问题
    List<MediaType> fastMediaTypes = new ArrayList<>();
    fastMediaTypes.add(MediaType.APPLICATION_JSON_UTF8);
    //4.在convert中添加配置信息.
    fastJsonHttpMessageConverter.setSupportedMediaTypes(fastMediaTypes);
    fastJsonHttpMessageConverter.setFastJsonConfig(fastJsonConfig);
    return new HttpMessageConverters((HttpMessageConverter<?>) fastJsonHttpMessageConverter);

}
 
Example 4
Source File: FastJsonConfiguration.java    From momo-cloud-permission with Apache License 2.0 6 votes vote down vote up
@Bean
    public HttpMessageConverters fastJsonConfigure(){
        FastJsonHttpMessageConverter converter = new FastJsonHttpMessageConverter();
        FastJsonConfig fastJsonConfig = new FastJsonConfig();
        fastJsonConfig.setSerializerFeatures(SerializerFeature.PrettyFormat);
        //日期格式化
        fastJsonConfig.setDateFormat("yyyy-MM-dd HH:mm:ss");
        //修改配置返回内容的过滤
        fastJsonConfig.setSerializerFeatures(
//                SerializerFeature. WriteMapNullValue,//是否输出值为null的字段,默认为false
                SerializerFeature.WriteDateUseDateFormat//格式化标签
//        		SerializerFeature.WriteNullListAsEmpty  ,//List字段如果为null,输出为[],而非null
//                SerializerFeature.DisableCircularReferenceDetect,//消除对同一对象循环引用的问题,默认为false(如果不配置有可能会进入死循环)
//                SerializerFeature.WriteMapNullValue,//是否输出值为null的字段,默认为false。
//                SerializerFeature.WriteNullStringAsEmpty//字符类型字段如果为null,输出为"",而非null
//                SerializerFeature.WriteNullBooleanAsFalse//Boolean字段如果为null,输出为false,而非null
        );
        converter.setFastJsonConfig(fastJsonConfig);
        //处理中文乱码问题
        List<MediaType> fastMediaTypes = new ArrayList<>();
        fastMediaTypes.add(MediaType.APPLICATION_JSON_UTF8);
        converter.setSupportedMediaTypes(fastMediaTypes);
        converter.setFastJsonConfig(fastJsonConfig);
        //将fastjson添加到视图消息转换器列表内
        return new HttpMessageConverters(converter);
    }
 
Example 5
Source File: FastJsonConfiguration.java    From momo-cloud-permission with Apache License 2.0 6 votes vote down vote up
@Bean
public HttpMessageConverters fastJsonConfigure(){
    FastJsonHttpMessageConverter converter = new FastJsonHttpMessageConverter();
    FastJsonConfig fastJsonConfig = new FastJsonConfig();
    fastJsonConfig.setSerializerFeatures(SerializerFeature.PrettyFormat);
    //日期格式化
    fastJsonConfig.setDateFormat("yyyy-MM-dd HH:mm:ss");
    //修改配置返回内容的过滤
    fastJsonConfig.setSerializerFeatures(
            SerializerFeature. WriteMapNullValue,//是否输出值为null的字段,默认为false
            SerializerFeature.WriteDateUseDateFormat,//格式化标签
    		SerializerFeature.WriteNullListAsEmpty , //List字段如果为null,输出为[],而非null
            SerializerFeature.DisableCircularReferenceDetect,//消除对同一对象循环引用的问题,默认为false(如果不配置有可能会进入死循环)
            SerializerFeature.WriteMapNullValue,//是否输出值为null的字段,默认为false。
            SerializerFeature.WriteNullStringAsEmpty,//字符类型字段如果为null,输出为"",而非null
            SerializerFeature.WriteNullBooleanAsFalse//Boolean字段如果为null,输出为false,而非null
    );
    converter.setFastJsonConfig(fastJsonConfig);
    //处理中文乱码问题
    List<MediaType> fastMediaTypes = new ArrayList<>();
    fastMediaTypes.add(MediaType.APPLICATION_JSON_UTF8);
    converter.setSupportedMediaTypes(fastMediaTypes);
    converter.setFastJsonConfig(fastJsonConfig);
    //将fastjson添加到视图消息转换器列表内
    return new HttpMessageConverters(converter);
}
 
Example 6
Source File: FastjsonConfiguration.java    From seed with Apache License 2.0 6 votes vote down vote up
@Bean
public HttpMessageConverters fastjsonConverter(){
    List<SerializerFeature> serializerFeatureList = new ArrayList<>();
    serializerFeatureList.add(SerializerFeature.PrettyFormat);
    serializerFeatureList.add(SerializerFeature.QuoteFieldNames);
    serializerFeatureList.add(SerializerFeature.WriteMapNullValue);
    serializerFeatureList.add(SerializerFeature.WriteNullListAsEmpty);
    serializerFeatureList.add(SerializerFeature.WriteNullNumberAsZero);
    serializerFeatureList.add(SerializerFeature.WriteNullStringAsEmpty);
    serializerFeatureList.add(SerializerFeature.WriteNullBooleanAsFalse);
    serializerFeatureList.add(SerializerFeature.WriteDateUseDateFormat);
    SerializerFeature[] serializerFeatures = new SerializerFeature[serializerFeatureList.size()];
    serializerFeatureList.toArray(serializerFeatures);
    FastJsonConfig fastJsonConfig = new FastJsonConfig();
    fastJsonConfig.setCharset(StandardCharsets.UTF_8);
    fastJsonConfig.setDateFormat("yyyy-MM-dd HH:mm:ss");
    fastJsonConfig.setSerializerFeatures(serializerFeatures);
    FastJsonHttpMessageConverter fastjson = new FastJsonHttpMessageConverter();
    fastjson.setFastJsonConfig(fastJsonConfig);
    return new HttpMessageConverters(fastjson);
}
 
Example 7
Source File: WebMvcConfig.java    From littleca with Apache License 2.0 6 votes vote down vote up
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
    //1.需要定义一个convert转换消息的对象;
    FastJsonHttpMessageConverter fastJsonHttpMessageConverter = new FastJsonHttpMessageConverter();
    //2.添加fastJson的配置信息,比如:是否要格式化返回的json数据;
    FastJsonConfig fastJsonConfig = new FastJsonConfig();
    fastJsonConfig.setSerializerFeatures(SerializerFeature.PrettyFormat);
    //3处理中文乱码问题
    List<MediaType> fastMediaTypes = new ArrayList<>();
    fastMediaTypes.add(MediaType.APPLICATION_JSON);
    fastJsonConfig.setCharset(Charset.forName("UTF-8"));
    //4.在convert中添加配置信息.
    fastJsonHttpMessageConverter.setSupportedMediaTypes(fastMediaTypes);
    fastJsonHttpMessageConverter.setFastJsonConfig(fastJsonConfig);
    //5.将convert添加到converters当中.
    converters.add(1, fastJsonHttpMessageConverter);
}
 
Example 8
Source File: WebMvcConfig.java    From spring-boot-cookbook with Apache License 2.0 6 votes vote down vote up
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
    FastJsonHttpMessageConverter httpMessageConverter = new FastJsonHttpMessageConverter();
    FastJsonConfig fastJsonConfig = new FastJsonConfig();
    fastJsonConfig.setSerializerFeatures(SerializerFeature.QuoteFieldNames,
            SerializerFeature.WriteEnumUsingToString,
            SerializerFeature.WriteMapNullValue,
            SerializerFeature.WriteDateUseDateFormat);
    fastJsonConfig.setSerializeFilters(new ValueFilter() {
        @Override
        public Object process(Object o, String s, Object source) {
            if (source == null) {
                return "";
            }
            if (source instanceof Date) {
                return ((Date) source).getTime();
            }
            return source;
        }
    });
    httpMessageConverter.setFastJsonConfig(fastJsonConfig);
    converters.add(httpMessageConverter);
}
 
Example 9
Source File: BeanConfig.java    From xmfcn-spring-cloud with Apache License 2.0 6 votes vote down vote up
/**
 * 替换springMVC JSON格式化工具为FastJSON,同时支持输出value=null的字段
 *
 * @return http message converters
 */
@Bean
public HttpMessageConverters fastJsonHttpMessageConverters() {
    //1.需要定义一个convert转换消息的对象;
    FastJsonHttpMessageConverter fastJsonHttpMessageConverter = new FastJsonHttpMessageConverter();
    //2:添加fastJson的配置信息;
    FastJsonConfig fastJsonConfig = new FastJsonConfig();
    fastJsonConfig.setSerializerFeatures(SerializerFeature.WriteMapNullValue);
    fastJsonConfig.setSerializeFilters();
    //3处理中文乱码问题
    List<MediaType> fastMediaTypes = new ArrayList<>();
    fastMediaTypes.add(MediaType.APPLICATION_JSON_UTF8);
    //4.在convert中添加配置信息.
    fastJsonHttpMessageConverter.setSupportedMediaTypes(fastMediaTypes);
    fastJsonHttpMessageConverter.setFastJsonConfig(fastJsonConfig);
    return new HttpMessageConverters(fastJsonHttpMessageConverter);

}
 
Example 10
Source File: MessageConfig.java    From framework with Apache License 2.0 5 votes vote down vote up
/**
 * 
 * Description: <br> 
 *  
 * @author 王伟<br>
 * @taskId <br>
 * @return <br>
 */
@Bean
public HttpMessageConverters fastJsonHttpMessageConverters() {
    // 1、需要先定义一个 convert 转换消息对象;
    FastJsonHttpMessageConverter fastConverter = new FastJsonHttpMessageConverter();

    FastJsonConfig fastJsonConfig = new FastJsonConfig();
    fastJsonConfig.setFeatures(Feature.AllowISO8601DateFormat);
    fastConverter.setFastJsonConfig(fastJsonConfig);

    return new HttpMessageConverters(new StringHttpMessageConverter(), fastConverter);
}
 
Example 11
Source File: ApplicationConfiguration.java    From spring-cloud-shop with MIT License 5 votes vote down vote up
@Bean
public HttpMessageConverters fastJsonConfigure() {
    FastJsonHttpMessageConverter converter = new FastJsonHttpMessageConverter();
    FastJsonConfig fastJsonConfig = new FastJsonConfig();
    fastJsonConfig.setSerializerFeatures(SerializerFeature.PrettyFormat);
    converter.setFastJsonConfig(fastJsonConfig);

    List<MediaType> supportedMediaTypes = new ArrayList<>();

    supportedMediaTypes.add(MediaType.APPLICATION_JSON);
    supportedMediaTypes.add(MediaType.APPLICATION_JSON_UTF8);
    supportedMediaTypes.add(MediaType.APPLICATION_ATOM_XML);
    supportedMediaTypes.add(MediaType.APPLICATION_FORM_URLENCODED);
    supportedMediaTypes.add(MediaType.APPLICATION_OCTET_STREAM);
    supportedMediaTypes.add(MediaType.APPLICATION_PDF);
    supportedMediaTypes.add(MediaType.APPLICATION_RSS_XML);
    supportedMediaTypes.add(MediaType.APPLICATION_XHTML_XML);
    supportedMediaTypes.add(MediaType.APPLICATION_XML);
    supportedMediaTypes.add(MediaType.IMAGE_GIF);
    supportedMediaTypes.add(MediaType.IMAGE_JPEG);
    supportedMediaTypes.add(MediaType.IMAGE_PNG);
    supportedMediaTypes.add(MediaType.TEXT_EVENT_STREAM);
    supportedMediaTypes.add(MediaType.TEXT_HTML);
    supportedMediaTypes.add(MediaType.TEXT_MARKDOWN);
    supportedMediaTypes.add(MediaType.TEXT_PLAIN);
    supportedMediaTypes.add(MediaType.TEXT_XML);
    converter.setSupportedMediaTypes(supportedMediaTypes);
    return new HttpMessageConverters(converter);
}
 
Example 12
Source File: WebConfig.java    From sanshanblog with Apache License 2.0 5 votes vote down vote up
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
    FastJsonHttpMessageConverter fastJsonHttpMessageConverter = new FastJsonHttpMessageConverter();
    FastJsonConfig config = new FastJsonConfig();
    config.setDateFormat("yyyy-MM-dd HH:mm:ss");
    fastJsonHttpMessageConverter.setFastJsonConfig(config);
    converters.add(fastJsonHttpMessageConverter);
    converters.add(resourceHttpMessageConverter);
    super.configureMessageConverters(converters);
}
 
Example 13
Source File: MvcConfigurer.java    From spring-boot-api-project-seed with Apache License 2.0 5 votes vote down vote up
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
    //使用阿里 FastJson 作为JSON MessageConverter
    FastJsonHttpMessageConverter converter = new FastJsonHttpMessageConverter();
    FastJsonConfig config = new FastJsonConfig();
    //保留空的字段
    config.setSerializerFeatures(SerializerFeature.WriteMapNullValue);
    // 按需配置,更多参考FastJson文档
    converter.setFastJsonConfig(config);
    converter.setDefaultCharset(Charset.forName("UTF-8"));
    converters.add(converter);
}
 
Example 14
Source File: WebMvcConfig.java    From spring-boot-vue-admin with Apache License 2.0 5 votes vote down vote up
/** 使用阿里 FastJson 作为 JSON MessageConverter */
@Override
public void configureMessageConverters(final List<HttpMessageConverter<?>> converters) {
  final FastJsonHttpMessageConverter converter = new FastJsonHttpMessageConverter();
  final FastJsonConfig config = new FastJsonConfig();
  converter.setSupportedMediaTypes(
      new ArrayList<MediaType>() {
        private static final long serialVersionUID = 1924772982095119650L;

        {
          this.add(MediaType.APPLICATION_JSON_UTF8);
          this.add(MediaType.APPLICATION_OCTET_STREAM);
          this.add(MediaType.IMAGE_GIF);
          this.add(MediaType.IMAGE_JPEG);
          this.add(MediaType.IMAGE_PNG);
        }
      });
  config.setSerializerFeatures(
      // 保留空的字段
      // SerializerFeature.WriteMapNullValue,
      // Number null -> 0
      SerializerFeature.WriteNullNumberAsZero,
      // 美化输出
      SerializerFeature.PrettyFormat);
  converter.setFastJsonConfig(config);
  converter.setDefaultCharset(StandardCharsets.UTF_8);
  converters.add(converter);
}
 
Example 15
Source File: Application.java    From AthenaServing with Apache License 2.0 5 votes vote down vote up
/**
 * fastjson 转换器
 *
 * @param converters
 */
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
	super.configureMessageConverters(converters);
	FastJsonHttpMessageConverter fastConverter = new FastJsonHttpMessageConverter();
	FastJsonConfig fastJsonConfig = new FastJsonConfig();
	fastJsonConfig.setSerializerFeatures(SerializerFeature.WriteMapNullValue);
	List<MediaType> fastMediaTypes = new ArrayList<>();
	fastMediaTypes.add(MediaType.APPLICATION_JSON_UTF8);
	fastConverter.setSupportedMediaTypes(fastMediaTypes);
	fastConverter.setFastJsonConfig(fastJsonConfig);
	converters.add(fastConverter);
}
 
Example 16
Source File: Application.java    From bookmark with MIT License 5 votes vote down vote up
@Bean
public HttpMessageConverters fastJsonHttpMessageConverters() {
    // 1.定义一个converters转换消息的对象
    FastJsonHttpMessageConverter fastConverter = new FastJsonHttpMessageConverter();
    // 2.添加fastjson的配置信息,比如: 是否需要格式化返回的json数据
    FastJsonConfig fastJsonConfig = new FastJsonConfig();
    fastJsonConfig.setSerializerFeatures(SerializerFeature.DisableCircularReferenceDetect);
    // 3.在converter中添加配置信息
    fastConverter.setFastJsonConfig(fastJsonConfig);
    // 5.返回HttpMessageConverters对象
    return new HttpMessageConverters(fastConverter);
}
 
Example 17
Source File: FastJsonConfiguration.java    From flower with Apache License 2.0 5 votes vote down vote up
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
  FastJsonConfig fastJsonConfig = new FastJsonConfig();
  fastJsonConfig.setSerializerFeatures(
      SerializerFeature.DisableCircularReferenceDetect, // SerializerFeature.WriteMapNullValue,
      SerializerFeature.WriteNullListAsEmpty, SerializerFeature.WriteNullStringAsEmpty,
      SerializerFeature.WriteNullBooleanAsFalse, SerializerFeature.PrettyFormat);
  fastJsonConfig.setCharset(Charset.forName("UTF-8"));
  fastJsonConfig.setDateFormat("yyyy-MM-dd HH:mm:ss");

  FastJsonHttpMessageConverter converter = new FastJsonHttpMessageConverter();
  converter.setFastJsonConfig(fastJsonConfig);
  converters.add(0, converter);
}
 
Example 18
Source File: DefaultFastjsonConfig.java    From MeetingFilm with Apache License 2.0 5 votes vote down vote up
@Bean
public FastJsonHttpMessageConverter fastJsonHttpMessageConverter() {
    FastJsonHttpMessageConverter converter = new FastJsonHttpMessageConverter();
    converter.setFastJsonConfig(fastjsonConfig());
    converter.setSupportedMediaTypes(getSupportedMediaType());
    return converter;
}
 
Example 19
Source File: LogisticsApplication.java    From logistics-back with MIT License 5 votes vote down vote up
@Bean
public HttpMessageConverters fastJsonHttpMessageConverters() {
	// 1.需要定义一个Convert转换消息的对象
	FastJsonHttpMessageConverter fastConverter = new FastJsonHttpMessageConverter();
	// 2.添加fastjson的配置信息,比如是否要格式化返回的json数据
	FastJsonConfig fastJsonConfig = new FastJsonConfig();
	fastJsonConfig.setSerializerFeatures(SerializerFeature.PrettyFormat);
	// 3.在convert中添加配置信息
	fastConverter.setFastJsonConfig(fastJsonConfig);

	HttpMessageConverter<?> converter = fastConverter;
	return new HttpMessageConverters(converter);
}
 
Example 20
Source File: FastjsonConfiguration.java    From seed with Apache License 2.0 4 votes vote down vote up
@Bean
public HttpMessageConverters fastjsonConverter(){
    List<SerializerFeature> serializerFeatureList = new ArrayList<>();
    //格式化输出(默认只会输出成一行的字符串)
    serializerFeatureList.add(SerializerFeature.PrettyFormat);
    //输出key时是否使用双引号,默认为true
    serializerFeatureList.add(SerializerFeature.QuoteFieldNames);
    //是否输出值为null的字段,默认为true
    serializerFeatureList.add(SerializerFeature.WriteMapNullValue);
    //List字段如果为null,输出为[],而非null
    serializerFeatureList.add(SerializerFeature.WriteNullListAsEmpty);
    //数值字段如果为null,输出为0,而非null
    serializerFeatureList.add(SerializerFeature.WriteNullNumberAsZero);
    //字符类型字段如果为null,输出为"",而非null
    serializerFeatureList.add(SerializerFeature.WriteNullStringAsEmpty);
    //Boolean字段如果为null,输出为false,而非null
    serializerFeatureList.add(SerializerFeature.WriteNullBooleanAsFalse);
    //使用默认的日期格式[yyyy-MM-dd HH:mm:ss]输出Date类型,未指定该属性则会将java.util.Date类型输出为1484030642746
    serializerFeatureList.add(SerializerFeature.WriteDateUseDateFormat);
    ////测试发现,无论是否设置该属性,都会输出:["age":0]、["age":123.456]
    //serializerFeatureList.add(SerializerFeature.WriteBigDecimalAsPlain);
    ////设置该属性会使得在输出时以字符串来输出非字符串的值,比如["age":"0"]、["abc":"false"],但是List不是这样,还是会输出["goodsList":[]]
    //serializerFeatureList.add(SerializerFeature.WriteNonStringValueAsString);
    ////假设序列化的实体类为com.jadyer.demo.open.model.ReqData,设置该属性会使得输出的json中增加一个key=["@type":"com.jadyer.demo.open.model.ReqData",]
    //serializerFeatureList.add(SerializerFeature.WriteClassName);
    ////设置该属性会使得序列化时增加特殊处理字符处理,比如原本的["mytime":"2017-01-10 14:56:41",]会输出为["mytime":"2017\u002D01\u002D10\u002014\u003A56\u003A41",]
    //serializerFeatureList.add(SerializerFeature.BrowserSecure);
    SerializerFeature[] serializerFeatures = new SerializerFeature[serializerFeatureList.size()];
    serializerFeatureList.toArray(serializerFeatures);

    FastJsonConfig fastJsonConfig = new FastJsonConfig();
    //Fastjson默认就是UTF-8
    fastJsonConfig.setCharset(StandardCharsets.UTF_8);
    //Fastjson默认就是[yyyy-MM-dd HH:mm:ss]
    fastJsonConfig.setDateFormat("yyyy-MM-dd HH:mm:ss");
    //设置序列化输出时的一些额外属性
    fastJsonConfig.setSerializerFeatures(serializerFeatures);

    FastJsonHttpMessageConverter fastjson = new FastJsonHttpMessageConverter();
    fastjson.setFastJsonConfig(fastJsonConfig);
    return new HttpMessageConverters(fastjson);
}