2 回答

TA贡献1900条经验 获得超5个赞
看来您对 Spring Rest API 和 Rest easy 实现感到困惑。
在 Resteasy 中,处理上传文件的正常方法是通过 MultipartFormDataInput 或通过 @MultipartForm 将上传文件映射到 POJO 类

TA贡献1893条经验 获得超10个赞
看看下面关于在 Spring Boot 中上传文件的教程
https://devkonline.com/tutorials/content/ANGULAR-8-SPRING-BOOT-FILE-UPLOAD

TA贡献1772条经验 获得超6个赞
您可能导入了不同的注释。试试这个方法
import org.springframework.web.bind.annotation.*;
import static org.springframework.http.MediaType.*;
@PostMapping(value = "/fileupload", consumes = MULTIPART_FORM_DATA_VALUE, produces = APPLICATION_JSON_VALUE)
public String uploadfile(@RequestParam(value = "file") MultipartFile file) {
System.out.println(file.getName());
return "Success String";
}
添加回答
举报