byte[]转MultipartFile
- pom
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>5.3.6</version>
</dependency>
- 代码示例
InputStream inputStream = new ByteArrayInputStream(fileByte)
MultipartFile file = new MockMultipartFile(ContentType.APPLICATION_OCTET_STREAM.toString(), inputStream);