I am using Spring framework in Java. With it I am trying to write an API endpoint that accepts one file for upload. I do NOT want to use form data. Basically I want the following curl command to work on my endpoint
curl -XPOST localhost:8080/upload -d @local_file.data
Is there a way to do that with Spring? It seems like I want to use @RequestBody with File but that somehow seems like a horrible idea to most people. Why? How is MultipartFile different from File? Only because it supports form data?
All I can find is talk of forms and MultipartFile. Is what I'm doing somehow inherently wrong? I've done it before using Python/Django and it wasn't that hard.