问题描述
我正在尝试在 SpringBoot-resource 目录中创建新文件。
这是我的代码:
File file = resourceLoader.getResource("classpath:testMountHostDirectory/infodiod/"
+ "epp.core.mq.public.outBox.url"
+ File.separator + "c81d4e2e-bcf2-11e6-869b-7df92533d2db.zip").
getFile();
try (FileOutputStream fos = new FileOutputStream(file);
ZipOutputStream zos = new ZipOutputStream(fos)) {
logger.warn("WRITE TO FILE ");
} catch (Exception exception) {
throw new IOException("Error writing file because by ",exception);
}
方法无一例外。
在 debag 中,我看到该文件(文件文件)名称是“/home/andrej/IdeaProjects/infodiode-sink/infodiode-sink-app/build/resources/test/testMountHostDirectory/infodiod/epp.core.mq。 public.outBox.url/c81d4e2e-bcf2-11e6-869b-7df92533d2db.zip"
但在此目录中没有创建任何内容。
我做错了什么?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)