免费视频淫片aa毛片_日韩高清在线亚洲专区vr_日韩大片免费观看视频播放_亚洲欧美国产精品完整版

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開(kāi)通VIP
org.springframework.web.multipart.commons.CommonsMultipartFile異常

摘要: 在項(xiàng)目中我們接收 CommonsMultipartFile對(duì)象時(shí),有時(shí)會(huì)報(bào)這種異常: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframewo...

在項(xiàng)目中我們接收 CommonsMultipartFile對(duì)象時(shí),有時(shí)會(huì)報(bào)這種異常:

org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.web.multipart.commons.CommonsMultipartFile]: No default constructor found; nested exception is java.lang.NoSuchMethodException: org.springframework.web.multipart.commons.CommonsMultipartFile.<init>()

...

Caused by: java.lang.NoSuchMethodException: org.springframework.web.multipart.commons.CommonsMultipartFile.<init>()


這是因?yàn)樵诮邮?nbsp;CommonsMultipartFile 對(duì)象時(shí),需要在對(duì)象前加 @RequestParam 注解 。

:public void getFile(@RequestParam CommonsMultipartFile file){}


有時(shí)也會(huì)遇到這個(gè)異常:

Required CommonsMultipartFile parameter 'pic' is not present


這是因?yàn)樘砑?span style="box-sizing: border-box;">@RequestParam 注解 后,接收到空的 CommonsMultipartFile 對(duì)象 , 所以 CommonsMultipartFile 允許為 null,添加required=false 即可。

:public void getFile(@RequestParam(required=false) CommonsMultipartFile file){}


本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)
打開(kāi)APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
SpringBoot RestController 空對(duì)象導(dǎo)致序列化異常
OpenSessionInView
基于Maven的Spring + Spring MVC + Mybatis的環(huán)境搭建 | AmazingHarry
springMVC文件上傳,報(bào)org.springframework.web.multipart.MultipartException: The current request is not a mu
SpringMVC上傳文件demo(轉(zhuǎn))
SPRING MVC3.2案例講解
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服