【发布时间】:2017-05-11 01:32:23
【问题描述】:
过去 3 天我一直在努力解决这个问题,当我尝试在我的 Spring Boot 项目中上传文件时,我不断收到以下异常。
org.springframework.web.multipart.support.MissingServletRequestPartException: Required request part 'file' is not present
我不确定它是否会有所不同,但我正在将我的应用程序部署为 weblogic 上的战争, 这是我的控制器
@PostMapping
public AttachmentDto createAttachment(@RequestParam(value = "file") MultipartFile file) {
logger.info("createAttachment - {}", file.getOriginalFilename());
AttachmentDto attachmentDto = null;
try {
attachmentDto = attachmentService.createAttachment(new AttachmentDto(file, 1088708753L));
} catch (IOException e) {
e.printStackTrace();
}
return attachmentDto;
}
我可以在 spring boot 执行器中看到多部分 bean
在 chrome 中看到的负载
【问题讨论】:
标签: file-upload spring-boot weblogic