软件编程
位置:首页>> 软件编程>> java编程>> springcloud feign传输List的坑及解决

springcloud feign传输List的坑及解决

作者:魔术师  发布时间:2023-06-20 18:31:57 

标签:springcloud,feign,传输,List

feign传输List的坑

无法直接传输List

错误方法1

@RequestMapping(value = "/stat/merchant/get_merchant_compare_info", method = RequestMethod.POST)
@ResponseBody
MerchantCompareTotalInfo getMerchantCompareInfo(
  @RequestParam(value = "licenseNoList")
  List<String> licenseNoList);

错误:

feign.FeignException: status 500 reading MerchantStatRemoteApi#getMerchantCompareInfo(List); content

错误方法2

@RequestMapping(value = "/stat/merchant/get_merchant_compare_info", method = RequestMethod.POST)
@ResponseBody
MerchantCompareTotalInfo getMerchantCompareInfo(@RequestBody List<String> licenseNoList);

错误:

feign.FeignException: status 500 reading MerchantStatRemoteApi#getMerchantCompareInfo(List); content

错误方法3

@RequestMapping(value = "/stat/merchant/get_merchant_compare_info", method = RequestMethod.POST)
@ResponseBody
MerchantCompareTotalInfo getMerchantCompareInfo(@RequestBody String[] licenseNoList);

服务端的数组是null

正确方法:

@RequestMapping(value = "/stat/merchant/get_merchant_compare_info", method = RequestMethod.POST)
@ResponseBody
MerchantCompareTotalInfo getMerchantCompareInfo(@RequestParam("licenseNoList") String[] licenseNoList);

feign调用传List接不到值

改为传数组 List<Long> 改为 Long[] 再用Arrays.asList()变成集合

来源:https://www.cnblogs.com/powerwu/p/10142101.html

0
投稿

猜你喜欢

手机版 软件编程 asp之家 www.aspxhome.com