@Bean
  public FormattingConversionService mvcConserConversionService() {

    DefaultFormattingConversionService conversionService =
        new DefaultFormattingConversionService(true);

    DateFormatterRegistrar registrar = new DateFormatterRegistrar();
    registrar.setFormatter(new DateFormatter("yyy-MM-dd"));
    registrar.registerFormatters(conversionService);

    return conversionService;
  }
Example #2
0
 @Bean
 public FormattingConversionService conversionService() {
   DefaultFormattingConversionService conversionService =
       new DefaultFormattingConversionService(false);
   conversionService.addFormatterForFieldAnnotation(new NumberFormatAnnotationFormatterFactory());
   DateFormatterRegistrar registrar = new DateFormatterRegistrar();
   DateFormatter dateFormatter = new DateFormatter();
   dateFormatter.setIso(ISO.DATE);
   registrar.setFormatter(dateFormatter);
   registrar.registerFormatters(conversionService);
   return conversionService;
 }