// Code snippet to read a json file within a class which the method is static try { InputStream resource = new ClassPathResource("paths.json").getInputStream(); final ObjectMapper mapper = new ObjectMapper(); final List<Path> pathsNotFound = new ArrayList<>(); MappingIterator<List<Path>> iterator = mapper.readValues(mapper.createParser(resource), new TypeReference<List<Path>>() { }); while (iterator.hasNext()) { List<Path> paths = iterator.next(); for (Path path : paths) { AclResourceDetails details = permissions.getResource(path.getName()); if (details == null) { pathsNotFound.add(path); } } log.info(pathsNotFound); } } catch (final IOException e) { log.error(e); }