发现了这个问题。问题在于资源ClassPathResource(文件)的类型,以及我将strict属性设置为false的事实。
reader.setResource(new ClassPathResource(file));
我应该用过
reader.setResource(new FileSystemResource(file));
这完全合情合理,因为我没有将文件作为类路径资源上传。