我在spring boot中使用转换服务。 这是我的配置类
@Configuration
public class ConversionServiceConfig {
@SuppressWarnings("rawtypes")
@Autowired
private Set<Converter> converters;
@Autowired
private ConversionService conversionService;
@PostConstruct
void initConverters() {
ConverterRegistry registry = (ConverterRegistry) conversionService;
converters.stream().forEach(converter -> {
registry.addConverter(converter);
});
}
}
在服务类
中@Autowired
private ConversionService conversionService;
我收到以下错误:
No qualifying bean of type 'org.springframework.core.convert.ConversionService' available: expected single matching bean but found 2: mvcConversionService,defaultConversionService