Java Spring集成http上载文件
我已经写了一个代码来上传图片到我的服务器上。我已经用SpringIntegration编写了这段代码,但是当我尝试将multipartfile恢复到服务中时,我遇到了这个错误Java Spring集成http上载文件,java,spring,spring-mvc,spring-integration,multipart,Java,Spring,Spring Mvc,Spring Integration,Multipart,我已经写了一个代码来上传图片到我的服务器上。我已经用SpringIntegration编写了这段代码,但是当我尝试将multipartfile恢复到服务中时,我遇到了这个错误 Caused by: java.lang.IllegalStateException: File has been moved - cannot be read again at org.springframework.web.multipart.commons.CommonsMultipartFile.getIn
Caused by: java.lang.IllegalStateException: File has been moved - cannot be read again
at org.springframework.web.multipart.commons.CommonsMultipartFile.getInputStream(CommonsMultipartFile.java:123)
我有一个控制器,它填充一个模型(文件和描述),然后通过消息通道将其发送到一个服务以处理图像。这是我的集成上下文的一部分
<channel id="photoProcessingChannel">
<queue />
</channel>
<outbound-channel-adapter channel="photoProcessingChannel" method="processingBufferphoto" ref="BufferphotoService">
<poller fixed-rate="2000"/>
</outbound-channel-adapter>
有什么建议吗?这个示例对您没有帮助吗?我的情况不同,我想通过controller上传文件,并将其发送到服务以保存到DBWell,我想您应该将
多部分文件
转换为字节[]
,在@controller
中只发送到频道
。