异常信息:
.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中新增接口