Spring Cloud Fegin 接口调用之类型转换异常处理

文章讨论了Feign调用中遇到的DecodeException和SpringMVC的类型转换问题,提出通过自定义WebMvcConfigurer解决将String转换为特定对象的问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1. 调用方异常信息

feign.codec.DecodeException: 内部错误,请稍后再试
	at feign.InvocationContext.proceed(InvocationContext.java:40)
	at feign.AsyncResponseHandler.decode(AsyncResponseHandler.java:116)
	at feign.AsyncResponseHandler.handleResponse(AsyncResponseHandler.java:89)
	at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:141)
	at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:91)
	at feign.ReflectiveFeign$FeignInvocationHandler.invoke(ReflectiveFeign.java:100)

2. 被调用方异常信息

Failed to convert value of type ‘java.lang.String’ to required type

org.springframework.web.method.annotation.MethodArgumentConversionNotSupportedException: Failed to convert value of type 'java.lang.String' to required type 'com.*.Xxx'; nested exception is java.lang.IllegalStateException: Cannot convert value of type 'java.lang.String' to required typ
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值