Example usage for org.springframework.web.bind WebDataBinder getConversionService

List of usage examples for org.springframework.web.bind WebDataBinder getConversionService

Introduction

In this page you can find the example usage for org.springframework.web.bind WebDataBinder getConversionService.

Prototype

@Nullable
public ConversionService getConversionService() 

Source Link

Document

Return the associated ConversionService, if any.

Usage

From source file:org.fenixedu.bennu.spring.FenixEDUBaseController.java

@InitBinder
public void initBinder(final WebDataBinder binder) {
    GenericConversionService conversionService = (GenericConversionService) binder.getConversionService();
    if (!conversionService.canConvert(String.class, IBean.class)) {
        GsonBuilder builder = new GsonBuilder();
        registerTypeAdapters(builder);//from  w ww . j a  v a 2  s  .  c o m
        conversionService.addConverter(new BeanConverterService(builder));
    }
    conversionService.addConverter(new CountryConverterService());
    conversionService.addConverter(new DistrictConverterService());
    conversionService.addConverter(new MunicipalityConverterService());

}