Spring MVC MultipartFile参数解析报错:Error resolving argument [2] [type=org.springframework.web.multipart.MultipartFile] 解决方法
您可以尝试将HttpServletRequest和HttpServletResponse参数移动到方法的末尾,并将@RequestPart注解应用于videoCoverPath参数,如下所示:
public void addEntity(@RequestPart("videoCoverPath") MultipartFile videoCoverPath, HttpServletRequest request, HttpServletResponse res) {
// 方法实现
}
这样应该可以解决报错。请注意,参数的顺序是重要的,因为Spring MVC会根据参数的类型来解析请求中的参数。
原文地址: https://www.cveoy.top/t/topic/pGvj 著作权归作者所有。请勿转载和采集!