@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; }
@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; }