将string类型地址转换为File和MultipartFile

local:  字符串地址
File file = new File(local);
FileInputStream input = new FileInputStream(file);
MultipartFile multipartFile =new MockMultipartFile("file", file.getName(),"text/plain",IOUtils.toByteArray(input));

依赖


    org.springframework
    spring-test
    5.3.2

你可能感兴趣的:(spring,java)