I also have a similar issue. However, I found that if I use ByteArrayResource when constructing the media, it doesn't work. But if I use FileSystemResource, everything works fine. Do you have any insights on this?
ByteArrayResource
FileSystemResource