Hello Alejandro,How do i Load a file from any location other than the file in resource folder.
Thanks in advance.
// file in src/main/resources/
Hello Alejandro,How do i Load a file from any location other than the file in resource folder.
Thanks in advance.
// file in src/main/resources/
Here’s an option:
StreamResource streamResource = new StreamResource(
"report.pdf", () -> {
try {
return FileUtils.openInputStream(
new File("/any/path/file.pdf"));
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
);