-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Replace custom converters with DefaultFormattingConversionService
#5186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Replace custom converters with DefaultFormattingConversionService
#5186
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
b8a8484 to
4aa4807
Compare
| * @deprecated since 6.1 in favor of | ||
| * {@link ConversionServiceFactory#createConversionService()}. Scheduled for removal in | ||
| * 6.3 or later. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since all existing converters are public, I proposed deprecating them for removal in 6.3. Let me know if I should make any adjustments to it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's how I would do it as well 👍
Signed-off-by: Stefano Cordio <[email protected]>
4aa4807 to
4725c88
Compare
|
Thank you for the PR! It's always better to leverage what we can from Spring Framework indeed. I will plan this for 6.1. I am just not sure yet if we really need the |
I created that because the FormattingConversionService conversionService = new DefaultFormattingConversionService();
conversionService.addFormatterForFieldType(Date.class, new DateFormatter());
DateTimeFormatterRegistrar dateTimeFormatterRegistrar = new DateTimeFormatterRegistrar();
dateTimeFormatterRegistrar.setUseIsoFormat(true);
dateTimeFormatterRegistrar.registerFormatters(conversionService);But I'm totally fine to inline it in those places or go in a different direction I haven't thought of, just let me know your preference 🙂 |
This change replaces almost all existing custom converters with the Spring Framework's
DefaultFormattingConversionServicebuilt-in features. TheDateconverters have been replaced with a custom formatter because the existing Spring Batch logic is incompatible with what the framework can offer.DefaultFormattingConversionServicealso supportsZonedDateTimeandOffsetDateTimeout of the box; therefore, this PR also resolves #5178 and is an alternative to #5179.