Example usage for org.springframework.core.convert.support DefaultConversionService addConverter

List of usage examples for org.springframework.core.convert.support DefaultConversionService addConverter

Introduction

In this page you can find the example usage for org.springframework.core.convert.support DefaultConversionService addConverter.

Prototype

@Override
    public void addConverter(Converter<?, ?> converter) 

Source Link

Usage

From source file:ch.algotrader.config.spring.DefaultConfigProvider.java

static ConversionService createDefaultConversionService() {
    DefaultConversionService conversionService = new DefaultConversionService();
    conversionService.addConverter(new StringToDateConverter());
    conversionService.addConverter(Date.class, String.class, new ObjectToStringConverter());
    return conversionService;
}

From source file:org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.java

private ConversionService getDefaultConversionService() {
    if (this.defaultConversionService == null) {
        DefaultConversionService conversionService = new DefaultConversionService();
        this.applicationContext.getAutowireCapableBeanFactory().autowireBean(this);
        for (Converter<?, ?> converter : this.converters) {
            conversionService.addConverter(converter);
        }//  w w w  . ja  v a2 s.c o m
        for (GenericConverter genericConverter : this.genericConverters) {
            conversionService.addConverter(genericConverter);
        }
        this.defaultConversionService = conversionService;
    }
    return this.defaultConversionService;
}