[英]Create and access zip file from resource folder during runtime in java spring boot application
My requirement is, I have to create one zip file and store in resource folder and once it's created, i have to pass this zip file to another api(which one will accept only.zip file as a input)through rest template.我的要求是,我必须创建一个 zip 文件并存储在资源文件夹中,一旦它被创建,我必须通过 rest 模板将这个 zip 文件传递给另一个 api(它只接受 zip 文件作为输入)。
Now my problem is after creating zip file im not able to access it.现在我的问题是在创建 zip 文件后我无法访问它。 I think this is because the file is not available in target folder.我认为这是因为该文件在目标文件夹中不可用。
How to solve this problem?如何解决这个问题呢?
Note: all these activities should happen in a single call.注意:所有这些活动都应该在一次调用中发生。
Technology: java 11, spring boot, maven Latest技术:java 11、spring开机、maven最新
the resource folder is normaly part of a jar. i would create a temp folder (java.nio.file.Files.createTempDirectory()) and store the zip there.资源文件夹通常是 jar 的一部分。我会创建一个临时文件夹 (java.nio.file.Files.createTempDirectory()) 并将 zip 存储在那里。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.