title: spring batch - Write object data to multiple files
body: <p>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. </p>
  
  <pre><code>clas Customer{
      long customerId;
      string name;
      Address add;
      Phone phn;
  }
  
  class Address{
      string address;
      long pincode;
      string street;
  }
  
  class Phone{
      string phoneNumber;
      string desc;
  }
  </code></pre>
  
  <p>I want to write the data of each customer to different text files such as </p>
  
  <pre><code>customer.txt -&gt; customerId, name
  address.txt -&gt; address, pincode, street
  phone.txt -&gt; phoneNumber, desc
  </code></pre>
  
  <p>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.</p>
  
  <p>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?</p>
  
  <p>Thanks in advance.</p>