springcloud feign传输List的坑

Posted 魔术师

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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);

 

以上是关于springcloud feign传输List的坑的主要内容,如果未能解决你的问题,请参考以下文章

关于springcloud 使用oauth2 和 feign 的坑

springcloud feign返回Map解析处理

Spring Cloud ZooKeeper集成Feign的坑3,程序Run模式运行没事,Debug模式下报错

feign接口注入失败问题

springcloud:Eureka客户端生产者消费者和feign的使用

微服务架构SpringCloud之Feign