try { Resource resource = new ClassPathResource("area-code/relayNumber.json"); reader = new BufferedReader(new InputStreamReader(resource.getInputStream())); //每次读取文件的缓存 String temp = null; while ((temp = reader.readLine()) != null) { data.append(temp); } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { //关闭文件流 if (reader != null) { try { reader.close(); } catch (IOException e) { e.printStackTrace(); } } } String str = data.toString();
Spring Boot访问静态文件
最新推荐文章于 2024-05-01 04:51:21 发布