使用如下方式读取文件:ClassPathResource cpr = new ClassPathResource("static/ok.png");byte[] bdata = FileCopyUtils.copyToByteArray(cpr.getInputStream());