feign文件上传-controller

时间:2024-10-13 22:02:31

注意两个接口的区别

@Api(tags = "文件")
@RestController
@RequestMapping("/file")
public class UploadController {
    @Resource
    private FileService fileService;



    @ApiOperation("上传文件")
    @PostMapping("/fileUpload")
    public ResponseModel uploadFile(@RequestPart MultipartFile uploadfile) {


        fileService.uploadFile(uploadfile);

        return new ResponseModel("200","ok");
    }

    @ApiOperation("上传文件2")
    @PostMapping("/fileUpload2")
    public ResponseModel uploadFile2(@RequestPart MultipartFile file) {


        fileService.uploadFile(file);

        return new ResponseModel("200","ok");
    }
}
  • feign的对应的controller
 @ApiOperation("上传文件")
    @PostMapping("/fileUpload")
    public ResponseModel uploadFile(@RequestPart MultipartFile uploadfile) {


        fileService.uploadFile(uploadfile);

        return new ResponseModel("200","ok");
    }