diff --git a/spring-boot-modules/spring-boot-mvc-4/src/main/java/com/baeldung/postman/controller/PostmanUploadController.java b/spring-boot-modules/spring-boot-mvc-4/src/main/java/com/baeldung/postman/controller/PostmanUploadController.java index ac19110318..6225a6b34b 100644 --- a/spring-boot-modules/spring-boot-mvc-4/src/main/java/com/baeldung/postman/controller/PostmanUploadController.java +++ b/spring-boot-modules/spring-boot-mvc-4/src/main/java/com/baeldung/postman/controller/PostmanUploadController.java @@ -5,6 +5,7 @@ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import com.baeldung.postman.model.JsonRequest; @@ -23,4 +24,10 @@ public class PostmanUploadController { return ResponseEntity.ok() .body(json.getId() + json.getName()); } + + @PostMapping("/uploadJsonAndMultipartData") + public ResponseEntity handleJsonAndMultipartInput(@RequestPart("data") JsonRequest json, @RequestPart("file") MultipartFile file) { + return ResponseEntity.ok() + .body(json.getId() + json.getName()); + } }