SpringCloud feign传输List的坑

  |   0 评论   |   0 浏览

 如遇图片加载失败,可尝试使用手机流量访问

无法直接传输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);

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