springcloud 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);

轉載地址:https://www.cnblogs.com/powerwu/p/10142101.html

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章