使用mybatis的collection属性报错

求是科技 发布于 2017/02/22 18:20
阅读 492
收藏 0

"exception": "org.springframework.http.converter.HttpMessageNotWritableException",
    "message": "Could not write content: No serializer found for class org.apache.ibatis.executor.loader.javassist.JavassistProxyFactory$EnhancedResultObjectProxyImpl and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) ) (through reference chain: com.chinamcloud.cms.api.dto.ReturnDto[\"returnData\"]->java.util.ArrayList[0]->com.chinamcloud.cms.repository.vo.CommentListVO_$$_jvst7cb_0[\"handler\"]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: No serializer found for class org.apache.ibatis.executor.loader.javassist.JavassistProxyFactory$EnhancedResultObjectProxyImpl and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) ) (through reference chain: com.chinamcloud.cms.api.dto.ReturnDto[\"returnData\"]->java.util.ArrayList[0]->com.chinamcloud.cms.repository.vo.CommentListVO_$$_jvst7cb_0[\"handler\"])",

加载中
0
蓝水晶飞机
蓝水晶飞机

http://moguichun.com/2016/04/18/SpringMVC-Mybatis%E6%95%B4%E5%90%88%E8%BF%94%E5%9B%9EJSON%E6%95%B0%E6%8D%AE%E5%87%BA%E7%8E%B0%E7%9A%84Could-not-write-content-No-serializer-found-for-class-%E9%94%99%E8%AF%AF%E8%A7%A3%E5%86%B3%E5%8A%9E%E6%B3%95/

蓝水晶飞机
蓝水晶飞机
嗯,用VO对输出可以的
求是科技
求是科技
实体类有一个属性是其它实体类的类型,mybatis默认使用了 延迟加载,导致在处理这个类的时候某些属性不能被序列化,因此造成了上述原因。
0
蓝水晶飞机
蓝水晶飞机

https://github.com/mybatis/mybatis-3/issues/570

返回顶部
顶部