异常信息:
.w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.web.method.annotation.MethodArgumentConversionNotSupportedException: Failed to convert value of type 'org.springframework.web.multipart.support.StandardMultipartHttpServletRequest$StandardMultipartFile' to required type 'org.springframework.web.multipart.commons.CommonsMultipartFile'; nested exception is java.lang.IllegalStateException: Cannot convert value of type 'org.springframework.web.multipart.support.StandardMultipartHttpServletRequest$StandardMultipartFile' to required type 'org.springframework.web.multipart.commons.CommonsMultipartFile': no matching editors or conversion strategy found]
处理方法:
1、在yml配置文件中加上
servlet:
multipart:
enabled: true
2、把SpringMvc使用的 @RequestParam CommonsMultiPartFile 替换为 @RequestParam MultipartFile file,如下图

即可处理此bug,如下加上其他配置限制上传的信息,可在multipart中新增接口
最后
以上就是追寻樱桃最近收集整理的关于Spring-boot: StandardMultipartFile不能转换为CommonsMultipartFile的问题的全部内容,更多相关Spring-boot:内容请搜索靠谱客的其他文章。
发表评论 取消回复