在Spring集成ftp之后
doc
@MessagingGateway
public interface MyGateway {
@Gateway(requestChannel = "toFtpChannel")
void sendToFtp(File file);
}
不锈钢
public static void main(String[] args) {
ConfigurableApplicationContext context =
new SpringApplicationBuilder(FtpJavaApplication.class)
.web(false)
.run(args);
MyGateway gateway = context.getBean(MyGateway.class);
// sending file to ftp server
gateway.sendToFtp(new File("/foo/bar.txt"));
}
在我看来,上面的代码使用自定义方法“sendtoptp()”将文件发送到目标ftp服务器。我的问题是,如何向MyGateway接口添加其他方法来实现操作?
ls (list files)
get (retrieve file)
mget (retrieve file(s))
rm (remove file(s))
mv (move/rename file)
put (send file)
mput (send multiple files)