Created
December 19, 2018 09:38
-
-
Save JorgenRingen/637db2e308a22853d84c1ed768033cac to your computer and use it in GitHub Desktop.
SpringBoot - Read file from a jar on classpath
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private String readContentFromFileInJarOnClasspath() { | |
try { | |
return StreamUtils.copyToString(new ClassPathResource("/lol.txt").getInputStream(), Charset.defaultCharset()); | |
} catch (IOException e) { | |
throw new RuntimeException(e); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment