In spring batch, I have a requirement where i have list of customer objects from database and from this list i need to create multiple text files.
clas Customer{
long customerId;
string name;
Address add;
Phone phn;
}
class Address{
string address;
long pincode;
string street;
}
class Phone{
string phoneNumber;
string desc;
}
I want to write the data of each customer to different text files such as
customer.txt -> customerId, name
address.txt -> address, pincode, street
phone.txt -> phoneNumber, desc
i tried using CompositeItemWriter which can delegate object to different writer but i could not get how to retrive specific object or properties in the writer.
I couldnt get any sample or explaination to implement CompositeWriter. can someone please help me with the writer implementation? Is there any other better way of doing it?
Thanks in advance.