File resource = new ClassPathResource("test.json").getFile(); String text = new String(Files.readAllBytes(resource.toPath()));