The service structure is very simple, and consumers call the service of the service provider through Feign.
The provider has a file upload function. According to the interface document, the parameter type is File, which is placed in parallel with other parameters.
Key points: 1. Use @RequestPart annotations for File parameters at the routing layer; 2. Add consumes = MediaType.MULTIPART_FORM_DATA_VALUE
instructions at the interface layer.
Routing layer
@PostMapping(value = "/notify/upload") @ApiOperation("上传通知音") public String upload ( AudioRecordScooperReq audioRecordScooperReq, @RequestPart("file") MultipartFile file) { audioRecordScooperReq.setToken(tokenValue); return audioRecordFeign.upload(audioRecordScooperReq, file); }
Feign interface layer
// 上传通知音 - @PostMapping(value = "/scooper-record/data/notify/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) String upload(@SpringQueryMap AudioRecordScooperReq audioRecordScooperReq, @RequestBody() MultipartFile file);
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。