我有以下一段代码,
@PostMapping(value = "/create/{userId}", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public ResponseEntity<Object> saveFile(
@Parameter(description = "ID of the user") @PathVariable(value = "userId") final String userId,
@Parameter(description = "Avatar of the user", content = @Content(mediaType = MediaType.APPLICATION_OCTET_STREAM_VALUE)) @RequestParam(value = "avatar", required = true) final MultipartFile file
) {
...
}
@GetMapping(value = "/get", produces = MediaType.IMAGE_PNG_VALUE)
@ApiResponse(responseCode = "200", description = "OK", content = {@Content(array = @ArraySchema(schema = @Schema(implementation = Byte.class)))})
public ResponseEntity<byte[]> getFile() {
...
}
我如何达到预期的效果?预期结果来自 Springfox。