The service structure is simple, and the consumer invokes the service provider’s service through Feign. Provider has an upload File function that, according to the interface document, is of type File and placed alongside other parameters.

Key points: 1. Routing layer File parameter annotated with @RequestPart; 2, Add the Consumes = MediaType.multipart_form_data_value, which is the case for the interface layer.

  1. The routing layer

    @postmapping (value = "/notify/upload") @apiOperation (" upload notification ") public String Upload (AudioRecordScooperReq audioRecordScooperReq, @RequestPart("file") MultipartFile file) { audioRecordScooperReq.setToken(tokenValue); return audioRecordFeign.upload(audioRecordScooperReq, file); }
  2. Feign interface layer

    / / upload notification sound - @ PostMapping (value = "/ scooper - record/data/notify/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) String upload(@SpringQueryMap AudioRecordScooperReq audioRecordScooperReq, @RequestBody() MultipartFile file);