ResponseEntity<Resource>
Learn ResponseEntity<Resource> (File Upload & Download, Spring MVC) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.
Fresher Notes ResponseEntity<Resource> returns a file or stream together with the status code and headers you choose. Why it fits downloads : you control Content-Type , Content-Disposition , Content-Length and caching headers, plus 404 for missing files. Build with ResponseEntity.ok().headers(...).contentType(...).body(resource) .