file from resource java spring code example
Example: load a file from classpath spring boot
private void testResource(Resource resource) {
try {
InputStream resourcee = resource.getInputStream();
String text = null;
try (final Reader reader = new InputStreamReader(resourcee)) {
text = CharStreams.toString(reader);
}
System.out.println(text);
} catch (IOException e) {
e.printStackTrace();
}
}