title: Spring Batch::How to generate file on sftp server using Spring Batch?
body: <p>I am using Spring Batch 2. version.I have generated the csv file and able to save in csv format on local.</p>
  
  <p>Now I want to generate the same file but it will be stored on SFTP server.</p>
  
  <p>I had gone through some tutorial which generates file on sftp server but they are using spring integration with Spring Batch.</p>
  
  <p><strong>Is it possible to generate the file on SFTP server using Spring Batch</strong> only?</p>
  
  <p>Below is itemReader bean defined::</p>
  
  <pre><code>&lt;bean id="itemReader"
          class="org.springframework.batch.item.database.JdbcCursorItemReader"
          scope="step"&gt;
          &lt;property name="dataSource" ref="dataSource" /&gt;
          &lt;property name="sql"
              value="select u.ID, u.USER_LOGIN, u.PASSWORD, u.AGE from USERS u" /&gt;
          &lt;/property&gt;
          &lt;property name="rowMapper"&gt;
              &lt;bean class="com.example.UserRowMapper" /&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  </code></pre>
  
  <p>ItemWriter Bean::</p>
  
  <pre><code>&lt;bean id="flatFileItemWriter" class="org.springframework.batch.item.file.FlatFileItemWriter"&gt;
          &lt;property name="resource" value="file:csv/user.csv" /&gt;
  
          &lt;property name="appendAllowed" value="true" /&gt;
          &lt;property name="lineAggregator"&gt;
              &lt;bean           class="org.springframework.batch.item.file.transform.DelimitedLineAggregator"&gt;
                  &lt;property name="delimiter" value="," /&gt;
                  &lt;property name="fieldExtractor"&gt;
                      &lt;bean
                          class="org.springframework.batch.item.file.transform.BeanWrapperFieldExtractor"&gt;
                          &lt;property name="names" value="name,age,id,password"/&gt;
                          &lt;/bean&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  </code></pre>