springBoot打成jar包时,下载模版文件报错FileNotFoundException,常规的方式是无法取得文件的,经过几次的试错,以下方式可以正常使用。
InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("template/template.xls");
springBoot打成jar包时,下载模版文件报错FileNotFoundException,常规的方式是无法取得文件的,经过几次的试错,以下方式可以正常使用。
InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("template/template.xls");