@ -1577,20 +1577,22 @@ For example, the following Java configuration registers a global `yyyyMMdd` form
@@ -1577,20 +1577,22 @@ For example, the following Java configuration registers a global `yyyyMMdd` form
public FormattingConversionService conversionService() {
// Use the DefaultFormattingConversionService but do not register defaults
DefaultFormattingConversionService conversionService = new DefaultFormattingConversionService(false);
DefaultFormattingConversionService conversionService =
new DefaultFormattingConversionService(false);
// Ensure @NumberFormat is still supported
conversionService.addFormatterForFieldAnnotation(new NumberFormatAnnotationFormatterFactory());
conversionService.addFormatterForFieldAnnotation(
new NumberFormatAnnotationFormatterFactory());
// Register JSR-310 date conversion with a specific global format
DateTimeFormatterRegistrar r egistrar = new DateTimeFormatterRegistrar();
r egistrar.setDateFormatter(DateTimeFormatter.ofPattern("yyyyMMdd"));
r egistrar.registerFormatters(conversionService);
DateTimeFormatterRegistrar dateTimeR egistrar = new DateTimeFormatterRegistrar();
dateTimeR egistrar.setDateFormatter(DateTimeFormatter.ofPattern("yyyyMMdd"));
dateTimeR egistrar.registerFormatters(conversionService);
// Register date conversion with a specific global format
DateFormatterRegistrar ano th er Registrar = new DateFormatterRegistrar();
ano th er Registrar.setFormatter(new DateFormatter("yyyyMMdd"));
ano th er Registrar.registerFormatters(conversionService);
DateFormatterRegistrar d ateRegistrar = new DateFormatterRegistrar();
d ateRegistrar.setFormatter(new DateFormatter("yyyyMMdd"));
d ateRegistrar.registerFormatters(conversionService);
return conversionService;
}
@ -1611,14 +1613,14 @@ For example, the following Java configuration registers a global `yyyyMMdd` form
@@ -1611,14 +1613,14 @@ For example, the following Java configuration registers a global `yyyyMMdd` form
addFormatterForFieldAnnotation(NumberFormatAnnotationFormatterFactory())
// Register JSR-310 date conversion with a specific global format
val r egistrar = DateTimeFormatterRegistrar()
r egistrar.setDateFormatter(DateTimeFormatter.ofPattern("yyyyMMdd"))
r egistrar.registerFormatters(this)
val dateTimeR egistrar = DateTimeFormatterRegistrar()
dateTimeR egistrar.setDateFormatter(DateTimeFormatter.ofPattern("yyyyMMdd"))
dateTimeR egistrar.registerFormatters(this)
// Register date conversion with a specific global format
val ano th er Registrar = DateFormatterRegistrar()
ano th er Registrar.setFormatter(DateFormatter("yyyyMMdd"))
ano th er Registrar.registerFormatters(this)
val d ateRegistrar = DateFormatterRegistrar()
d ateRegistrar.setFormatter(DateFormatter("yyyyMMdd"))
d ateRegistrar.registerFormatters(this)
}
}
}