使用spring集成将Excel或xls文件发送到远程目录

我已经使用Apache POI API生成一个Excel文件,并试图使用Spring Integration将它发送到远程目录,但是当我编写下面给出编译时错误的代码时,因为它只支持“文件”types的对象Exceltypes是“HSSFWorkbook”。

HSSFWorkbook workbook = gerateExcelFile(data); excelCollector.add((workbook); 

并使用下面的代码“入站通道适配器”

 <inbound-channel-adapter id="excelAdapter" auto-startup="true" ref="excelCollector" method="poll" channel="excelInputChannel"> <poller fixed-rate="500"/> </inbound-channel-adapter> 

该框架不知道如何处理任意对象。

您可能需要将工作簿写入File或将其转换为包含工作簿内容的字节[],然后发送该文件。