我有一个这样的例外,它是由于尝试序列化"处理程序"而引起的。对于hibernate延迟加载。
org.springframework.http.converter.HttpMessageNotWritableException: Could not write JSON: No serializer found for class org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS) ) (through reference chain: org.apache.commons.collections.map.HashedMap["results"]->java.util.ArrayList[0]->net.pack.tx.model.Proc["client"]->net.pack.tx.model.Client_$$_jvst8e_1a["handler"]);
但是,我在Proc和Client类注释中同时使用它们
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
我也在父类(Proc.class)注释中使用
@JsonManagedReference("client")
Client client;
导致例外:
objConverter.write(resultsJson, jsonMimeType,
new ServletServerHttpResponse(response));
如何解决此问题?