java.lang.ClassCastException:oracle.jdbc.driver.OracleBlobInputStream无法强制转换为org.springframework.core.io.InputStreamSource
helper.addAttachment(MyDTO.getFileName(), (InputStreamSource) MyDTO.getBlobInputStream());
从inputStream
转换为InputStreamSource
时,我收到此异常。
答案 0 :(得分:0)
您不能将其强制转换为InputStreamSource
,OracleBlobInputStream不会实现此特定于Spring的接口。您必须使用org.springframework.core.io.InputStreamResource
helper.addAttachment(MyDTO.getFileName(), new InputStreamResource(MyDTO.getBlobInputStream()));