Reputation: 371
I've been doing some research, and can't seem to find any tutorials or articles discussing how to perform in depth formatting on an output file in Spring Batch.
For example, I want some output that looks like this
Header
---------------------------------------------
name state zip phone
---------------------------------------------
name state zip phone
---------------------------------------------
The problem here is writing the line separator between each row of records I print. Any ideas or tips on achieving this output?
Upvotes: 0
Views: 294
Reputation: 31600
You can use the FormatterLineAggregator for that. This LineAggregator
uses the java.util.Formatter
syntax, so you can use it to format each line with an appropriate format.
In regards to the header, you need to specify a FlatFileHeaderCallback in which you write the header as needed.
Upvotes: 1