天天看点

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就可以了

今天你进步了吗?