springcloud|springcloud feign传输List的坑及解决
目录
- feign传输List的坑
- 错误方法1
- 错误方法2
- 错误方法3
- feign调用传List接不到值
feign传输List的坑 无法直接传输List
【springcloud|springcloud feign传输List的坑及解决】
错误方法1
@RequestMapping(value = "https://www.it610.com/stat/merchant/get_merchant_compare_info", method = RequestMethod.POST)@ResponseBodyMerchantCompareTotalInfo getMerchantCompareInfo(@RequestParam(value = "https://www.it610.com/article/licenseNoList")List licenseNoList);
错误:
feign.FeignException: status 500 reading MerchantStatRemoteApi#getMerchantCompareInfo(List); content
错误方法2
@RequestMapping(value = "https://www.it610.com/stat/merchant/get_merchant_compare_info", method = RequestMethod.POST)@ResponseBodyMerchantCompareTotalInfo getMerchantCompareInfo(@RequestBody List licenseNoList);
错误:
feign.FeignException: status 500 reading MerchantStatRemoteApi#getMerchantCompareInfo(List); content
错误方法3
@RequestMapping(value = "https://www.it610.com/stat/merchant/get_merchant_compare_info", method = RequestMethod.POST)@ResponseBodyMerchantCompareTotalInfo getMerchantCompareInfo(@RequestBody String[] licenseNoList);
服务端的数组是null
正确方法:
@RequestMapping(value = "https://www.it610.com/stat/merchant/get_merchant_compare_info", method = RequestMethod.POST)@ResponseBodyMerchantCompareTotalInfo getMerchantCompareInfo(@RequestParam("licenseNoList") String[] licenseNoList);
feign调用传List接不到值 改为传数组 List
以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。
推荐阅读
- springcloud|springcloud gateway网关服务启动报错的解决
- 聊聊SpringCloud中的Ribbon进行服务调用的问题
- SpringCloud|《微服务系列(Nacos服务配置中心》)
- #|SpringCloud Alibaba微服务中Nacos的服务注册与发现
- SpringCloud|SpringCloud Gateway之请求应答日志打印方式
- SpringCloud|SpringCloud Feign多参数传递及需要注意的问题
- 网络标准之:IANA定义的传输编码
- feign参数过多导致调用失败的解决方案
- 简单实现一个快速传输电子书到kindle的小项目
- SpringCloud|SpringCloud maven-assembly-plugin 多级目录打包的实现