package cn.axzo.msg.center.notices.manager.support;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.convert.converter.Converter;
import org.springframework.core.convert.support.GenericConversionService;

import java.util.List;

/**
 * 自动转换配置类
 *
 * @author zhaoyong_sh
 * @see ConversionServiceConfig
 * @since 2021-05-27 18:26
 */
@Configuration
public class ConversionServiceConfig {

  @Bean("genericConversionService")
  public GenericConversionService genericConversionService(List<Converter> converters){
    GenericConversionService conversionService = new GenericConversionService();
    converters.forEach(converter -> conversionService.addConverter(converter));
    return conversionService;
  }

}
