Skip to content

What is the spring batch way of formatting CSV fields individually? #4748

Closed Answered by fmbenhassine
Sax388 asked this question in Q&A
Discussion options

You must be logged in to vote

The FieldSetMapper is the main extension point for converting a typed fieldset to a domain object. There an are few implementations provided by spring batch, but you might need a custom one if nothing from the provided ones really help.

In your case, you can use a BeanWrapperFieldSetMapper if the target type is a java class or RecordFieldSetMapper for java records. Both provide a configurable conversion service in which you can register custom converter like the one you shared (you just need to adapt it to the expected conversion type).

If you share a GitHub repo or a zip with a minimal code example / input file, I can try to help you implement the mapping logic with spring batch.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Sax388
Comment options

Answer selected by Sax388
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants