在azure文件共享中读写文件

mkshixfv  于 2021-06-27  发布在  Java
关注(0)|答案(0)|浏览(227)

我有一个springboot应用程序,它读取一个文件,对其进行处理,然后将其写入另一个文件(如果不存在,则创建新文件)。它在我当地的环境中工作得很好。

BufferedWriter bw = Files.newBufferedWriter(Paths.get("Local Path to output file"));

// Using java nio's**Files**and**Paths**to read the file        
Files.lines(Paths.get("Local Path to input file"))
                .forEach(record -> {
                    try {
                        bw.write(record);
                    } catch (IOException ex) {
                        throw new UncheckedIOException(ex);
                    }
                });

但现在我希望这个 Spring 启动应用程序部署在azurekubernetes(aks)中,将azurefileshare作为卷装载。有没有一种方法可以让我用同样的代码读写附件中的文件?或者不在代码中做很多更改。例如,将输入输出文件的路径从local更改为fileshare。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题