第一种方法:
<dependency>
<groupId>com.mchange</groupId>
<artifactId>mchange-commons-java</artifactId>
<version>0.2.7</version>
</dependency>
String str= FileUtils.getContentsAsString(new File(path))
第二种方法:
String json = "";
try {
File jsonFile = ResourceUtils.getFile("classpath:getIrAttribute.json");
json = FileUtils.readFileToString(jsonFile);
}
catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}