一.检查MultipartFile对象所需依赖是否导入
maven 依赖片段xml
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>5.0.5.RELEASE</version>
<scope>compile</scope>
</dependency>
二.创建MultipartFile
MultipartFile 对象创建
import org.springframework.web.multipart.MultipartFile;
import org.apache.http.entity.ContentType;
MultipartFile multipartFile = new MockMultipartFile(name,name,ContentType.APPLICATION_OCTET_STREAM.toString(),acceptFile);
原创文章,作者:端木书台,如若转载,请注明出处:https://blog.ytso.com/243618.html