idea测试类读取resources目录的文件

idea测试类读取resources目录的文件
    String fileName = "大帐银行间.xlsx";
    InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("file/大帐银行间.xlsx");
    MultipartFile multipartFile = new MockMultipartFile(fileName,fileName, ContentType.APPLICATION_OCTET_STREAM.toString(),inputStream);
    System.out.println(multipartFile.getName()); // 输出xlsx名称

猜你喜欢

转载自blog.csdn.net/qq_35275233/article/details/88665509