springboot应用A通过httpclient获得另一个springboot的httpresponse时报错:
WARN ExceptionHandlerExceptionResolver:140 - Resolved [org.springframework.http.converter.HttpMessageConversionException: Type definition error: [simple type, class org.apache.http.conn.EofSensorInputStream]; nested exception is com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class org.apache.http.conn.EofSensorInputStream and no properties discovered to create BeanSerializer
(to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS)(through reference chain: org.apache.http.impl.execchain.HttpResponseProxy["entity"]->org.apache.http.impl.execchain.ResponseEntityProxy["content"])]
解决方案:
jackson:
serialization:
FAIL_ON_EMPTY_BEANS: false
yaml中增加配置
参考:
本文解决了一个在SpringBoot应用中使用HttpClient调用另一个SpringBoot应用时出现的序列化错误。错误发生在尝试序列化org.apache.http.conn.EofSensorInputStream类时。解决方案是在yaml配置文件中添加jackson配置,禁用FAIL_ON_EMPTY_BEANS选项。
1433

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



