//读取配置文件
//fileName="conf.json";
public String getConf(String fileName) {
String content="";
try {
//jsonFile = ResourceUtils.getFile("classpath:"+fileName);
ClassPathResource resource = new ClassPathResource(fileName);
InputStream stream = resource.getInputStream();
content = IOUtils.toString(stream);
} catch (FileNotFoundException e) {
e.printStackTrace();
}catch (IOException e) {
logger.error("no file found!", e);
}
logger.info("配置文件:{}"+content);
return content;
}
读取resource根目录下的配置文件---标准
猜你喜欢
转载自blog.csdn.net/qq_33999844/article/details/86223770
今日推荐
周排行