title: how to download file from sftp server using spring integration without using spring boot
body: <p>I have a requirement where I want to use spring integration but <strong>don't want to use spring boot</strong> to download the file from sftp server.
  I am using jcraft library here. Want to use spring-integration libraries.</p>
  
  <pre><code>public void downloadFileFromSftpServer () {
          String hostname = "XXX";
          String username = "XXX";
          String password = "XXX";
          String copyFrom = "XXX";
          String copyTo = "XXX";
          JSch jsch = new JSch();
          Session session;
          System.out.println("Trying to connect.....");
          try {
              session = jsch.getSession(username, hostname, 22);
              session.setConfig("StrictHostKeyChecking", "no");
              session.setPassword(password);
              session.connect();
              Channel channel = session.openChannel("sftp");
              channel.connect();
              System.out.println ("Connection successful.");
              ChannelSftp sftpChannel = (ChannelSftp) channel;
              Vector &lt;ChannelSftp.LsEntry&gt; vector = (Vector&lt;ChannelSftp.LsEntry&gt;) sftpChannel.ls(copyFrom);
              ChannelSftp.LsEntry list = vector.get(0);
              System.out.println(list.getFileName());
              String oldestFile =list.getFilename();
              sftpChannel.get(copyFrom+oldestFile, copyTo);
      }
  </code></pre>