Load json file from resource
I have a problem with loading a JSON file from a resource file. Here is my code: public void setConfiguration() { try { ClassLoader cl = this.getClass().getClassLoader(); ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(cl); Resource[] resources = resolver.getResources("classpath*:/configuration.json"); if (resources.length == 0) { log.warn("Configuration could not be loaded from file! Using " + "default configuration."); configuration = getDefaultConfiguration(); } for (Resource resource : resources) { configuration = new ObjectMapper().readValue( resource.getInputSt
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.