Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/309.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 限制所有类的序列化/反序列化深度_Java_Json_Spring_Jackson - Fatal编程技术网

Java 限制所有类的序列化/反序列化深度

Java 限制所有类的序列化/反序列化深度,java,json,spring,jackson,Java,Json,Spring,Jackson,我已尝试了来自的CustomJSONSerializer 但有以下例外: com.fasterxml.jackson.databind.JsonMappingException: object is not an instance of declaring class (through reference chain: com.fasterxml.jackson.databind.type.SimpleType["test"]) at com.fasterxml.jackson.databin

我已尝试了来自的
CustomJSONSerializer

但有以下例外:

com.fasterxml.jackson.databind.JsonMappingException: object is not an instance of declaring class (through reference chain: com.fasterxml.jackson.databind.type.SimpleType["test"])
at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:232)
at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:197)
at com.fasterxml.jackson.databind.ser.std.StdSerializer.wrapAndThrow(StdSerializer.java:183)
我想像这样序列化实体

实体A

实体A.母公司


实体A.Parent.Parent

我在从jackson 2.1.5切换到2.2.0(或2.2.1)时也遇到了这个错误,是否尝试将jackson降级到2.1.5?假设这是由于2.2中更严格的检查造成的,但还没有找到纠正方法

你能给我们展示一下你的类和示例JSON吗?