概述
解决办法:将参数用对象包裹,然后使用@RequestBody来代替@RequestParam。
从下面的报错日志能够看出请求的url有多么的长:
022-11-09 14:24:05.436 [ERROR] [meiju.commerce.service][http-nio-30102-exec-5] [c.j.f.c.f.c.fallback.FeignFallbackProxy] [hujbysufxr363m7kjmjnn25d]: FeignFallback. callerApp=meiju.commerce.service, calleeApp=meiju.sys.service, url=/user/getNameByCreateUser, httpCode=400, bizCode=-1, bizMsg=null
feign.FeignException$BadRequest: [400 ] during [POST] to [http://meiju.sys.service/user/getNameByCreateUser?createUserId=1383955428958220996&createUserId=1383955429058884085&createUserId=1383955429075661567&createUserId=1383955429092438414&createUserId=1383955428891112186&createUserId=1383955428891112186&createUserId=1383955428891112186&createUserId=1383955428891112186&createUserId=1383955428891112186&createUserId=1383955428891112186&createUserId=1383955428891112186&createUserId=1383955429075661723&createUserId=1383955428891112186&createUserId=1383955428891112186&createUserId=1383955428891112186&createUserId=1383955428891112186&createUserId=1383955428891112186&createUserId=1383955428891112186&createUserId=1383955428958220996&createUserId=1383955428958220996&createUserId=1383955428891112186&createUserId=1383955428891112186&createUserId=1383955429042106779&createUserId=1383955429042106779&createUserId=1439413095243644928&createUserId=1439413095243644928&createUserId=1439413095243644928&createUserId=1439413095243644928&createUserId=1383955428958220996&createUserId=1383955428958220996&createUserId=1470097429675921551&createUserId=1383955429058883777&createUserId=1383955429042106779&createUserId=1383955429042106779&createUserId=1470097429675921551&createUserId=1470097429675921551&createUserId=1383955429075661266&createUserId=1383955428891112186&createUserId=1439413095243644928&createUserId=1439413095243644928&createUserId=1439413095243644928&createUserId=1439413095243644928&createUserId=1439413095243644928&createUserId=1383955429075661447&createUserId=1383955429075661447&createUserId=1383955428941443622&createUserId=1383955429075660997&createUserId=1383955429075661723&createUserId=1412491392647151616&createUserId=13839554290756
总结:尽量使用对象包裹参数 然后注解使用@RequestBody来将其转为Json,这样就可避免此错。
最后
以上就是沉默河马为你收集整理的参数使用@RequestParam导致url携带的参数过长而报错的全部内容,希望文章能够帮你解决参数使用@RequestParam导致url携带的参数过长而报错所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复