读取spring工程中resource的文件

    Resource resource = new ClassPathResource("data.json");

    // 读文件到字符串
    String fileContent = FileUtils.readFileToString(resource.getFile(), "UTF-8");

猜你喜欢

转载自www.cnblogs.com/haorui/p/9177993.html