需求:后端需要同時(shí)接收文件及對(duì)象,或者需要接收多個(gè)對(duì)象
實(shí)現(xiàn)方法:后端使用@RequestPart接收
Controller
@Slf4j
@RequestMapping("/postman")
@RestController
public class PostmanParam {
@PostMapping(value = "twoGirlfriendsAndFile")
public String postman4(@RequestPart("file") MultipartFile file,
@RequestPart("child1") Child child1,
@RequestPart("child2")Child child2){
if(file != null){
log.error("接收到文件");
}
return child1.toString()+child2.toString();
}
}
Postman設(shè)置
?文章來源:http://www.zghlxwxcb.cn/news/detail-606598.html
?文章來源地址http://www.zghlxwxcb.cn/news/detail-606598.html
到了這里,關(guān)于Postman傳多個(gè)參數(shù)入?yún)⒌奈恼戮徒榻B完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!