Could not write JSON: No serializer found for class
[ERROR][2021-07-21T16:39:41.557+0800][com.xiaojukeji.epower.atreus.common.configuration.GlobalExceptionHandler:116] _am_epower_atreus||traceid=07684ea1095649b0a4ef6ff2aa450ab4||spanid=88106210516f24dc||_msg=99999
org.springframework.http.converter.HttpMessageNotWritableException: Could not write JSON: No serializer found for class com.xiaojukeji.epower.atreus.common.base.vo.smartcharging.order.OrderManagerVO and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS); nested exception is com.fasterxml.jackson.databind.JsonMappingException: No serializer found for class com.xiaojukeji.epower.atreus.common.base.vo.smartcharging.order.OrderManagerVO and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain: com.xiaojukeji.epower.component.Response["data"]->com.baomidou.mybatisplus.extension.plugins.pagination.Page["records"]->java.util.ArrayList[0])
Caused by: com.fasterxml.jackson.databind.JsonMappingException:
No serializer found for class
com.xiaojukeji.epower.atreus.common.base.vo.smartcharging.order.OrderManagerVO and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain: com.xiaojukeji.epower.component.Response["data"]->com.baomidou.mybatisplus.extension.plugins.pagination.Page["records"]->java.util.ArrayList[0])
問題原因:
實體lombok註解@Accessors(chain = true)中fluent=true不要使用,不然在spring內部轉json時會報以上錯誤
另外最近使用easyexcel匯出時也出現的詭異問題
easyexcel實體使用Accessors註解會無法讀取資料
建議乾脆別用這個註解了,問題太特麼多了。心累。用Builder就可以了
今天你進步了嗎?