更新时间:2023-11-22 11:53:40
我发现,可能导致此问题的原因有-
Couple of reasons, I found, that can cause this issue are -
我有一个字段private boolean success
和2个设置方法-
I had a field private boolean success
and 2 setter methods -
public void setSuccess(List<Object> dataList);
public void setSuccess(boolean success);
在调试时,我发现类com.fasterxml.jackson.databind.deser.BeanDeserializerFactory
引发异常.此异常在Jackson的lib中被抑制,RestTemplate抛出的异常与主题相同.
On debugging, I found that class com.fasterxml.jackson.databind.deser.BeanDeserializerFactory
was throwing an exception. This exception was suppressed within Jackson's lib and the exception thrown by the RestTemplate was the same as the subject.
java.lang.IllegalArgumentException: Conflicting setter definitions for property "failure": com.test.dto.JsonResponse#setFailure(1 params) vs com.test.dto.JsonResponse#setFailure(1 params)
我将方法更改为public void setSuccessData(List<Object> dataList);
,并且效果很好.
I changed the method to public void setSuccessData(List<Object> dataList);
and it worked fine.
希望这对某人有帮助.