I want to consume both JSON & files in an API for my spring boot application (using Spring WebFlux). I tried multiple ways as was recommended over the internet (Article1, Article2, Article3), but it's not working for me. The API is not being hit and getting status 415 (Unsupported Media Type) from Postman.
Spring-Boot version : 2.5.3
Spring-Web/Webflux version : 5.3.9
Employee :
@Data@NoArgsConstructor@AllArgsConstructorpublic class Employee { private String name; private int age; private int mobileNo; private List<MultipartFile> files;}
Controller :
@PostMapping(path = "employee", consumes = {MediaType.APPLICATION_JSON_VALUE, MediaType.MULTIPART_FORM_DATA_VALUE})public Mono<Response> processEmployeeDocs(@RequestPart Employee request, @RequestPart List<MultipartFile> files) { Employee employee = new Employee(request.getName(), request.getAge(), request.getMobileNo(), files); return employeeService.processDocs(employee);}