我有一个小的spring启动应用程序,它通过JSON向服务器发送请求。 我像这样配置了application.properties:
spring.jackson.deserialization.fail-on-unknown-properties=true
spring.jackson.serialization.indent_output=true
spring.jackson.serialization.write_null_map_values=false
但是当我发送我的对象时,我得到了一个延迟初始化的错误:
2015-08-03 18:21:04.455 ERROR:SynchroRequest - Could not write content: failed to lazily initialize a collection of role: com.domitik.domitikCDB.model.Box.users, could not initialize proxy - no Session (through reference chain: ....); nested exception is com.fasterxml.jackson.databind.JsonMappingException: failed to lazily initialize a collection of role:
似乎没有使用/加载定义。
我也尝试制作自己的ObjectMapper而没有任何结果:
ObjectMapper om = new ObjectMapper();
om.configure(SerializationFeature.WRITE_NULL_MAP_VALUES,false);
om.configure(SerializationFeature.INDENT_OUTPUT,true);
om.setSerializationInclusion(Include.NON_NULL);
restTemplate.getMessageConverters().add(new MappingJackson2HttpMessageConverter(om));
知道我做错了什么吗? 谢谢,