微服务框架调用feign接口传参时报错:只截取了主要的报错信息
java.lang.IllegalStateException: No primary or default constructor found for interface java.util.List
org.springframework.web.client.RestClientException: Could not extract response: no suitable HttpMessageConverter found for response type [com.sinosoft.app.base.utils.Result<java.lang.String>] and content type [text/plain;charset=UTF-8]
com.netflix.hystrix.exception.HystrixRuntimeException: IFinancialFeign#addProvisionToFinancialTrans(List) failed and no fallback available.
通过下面这句话锁定问题关键所在
No primary or default constructor found for interface java.util.List
如果是post请求,在接口的请求参数前加上@RequestBody就可以了,
如果是get请求,加@RequestParam(“XXX”)


出现IFinancialFeign#addProvisionToFinancialTrans(List) failed and no fallback available.这个错误的话,原因有很多,具体还要查看日志中是否报其他有针对性的错误,然后再往feign接口方面考虑。
本文探讨了在使用微服务框架调用Feign接口时遇到的参数传递问题,特别是针对List类型参数的处理。文章详细分析了错误信息,如'Noprimaryordefaultconstructorfoundforinterfacejava.util.List'和'IFinancialFeign#addProvisionToFinancialTrans(List)failedandnofallbackavailable.',并提供了解决方案,包括使用@RequestBody和@RequestParam注解。
1143

被折叠的 条评论
为什么被折叠?



