springboot jar包 无法读取静态资源文件
参考 springboot项目读取resources目录下的文件的9种方式
Resource resource = resourceLoader.getResource("classpath:static/jkbw/jkbw4.txt");
try{
InputStream inputStream = resource.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
StringBuilder out = new StringBuilder();
String newLine = System.getProperty("line.separator");
String line;
while ((line = reader.readLine()) != null) {
out.append(line);
out.append(newLine);
}
return out;
} catch (IOException e) {
e.printStackTrace();
}