@@ -0,0 +1,1895 @@
+package com.gochinatv.cdn.api.objectmapper;%0A%0Aimport lombok.Data;%0Aimport org.codehaus.jackson.JsonParser;%0Aimport org.codehaus.jackson.JsonProcessingException;%0Aimport org.codehaus.jackson.annotate.JsonCreator;%0Aimport org.codehaus.jackson.map.DeserializationConfig;%0Aimport org.codehaus.jackson.map.DeserializationContext;%0Aimport org.codehaus.jackson.map.JsonDeserializer;%0Aimport org.codehaus.jackson.map.ObjectMapper;%0Aimport org.codehaus.jackson.map.annotate.JsonDeserialize;%0A%0Aimport java.io.IOException;%0Aimport java.util.Map;%0A%0Apublic class TestMapper %7B%0A%0A%0A    public static void main(String%5B%5D args) %7B%0A        String json = %22%7B%5C%22id%5C%22:%5C%221%5C%22,%5C%22name%5C%22:%5C%22zhuhh%5C%22,%5C%22address%5C%22:%5C%22%7B%5C%22id%5C%22:%5C%22222%5C%22,%5C%22name%5C%22:%5C%22333%5C%22%7D%5C%22%7D%22;%0A        ObjectMapper mapper = new ObjectMapper();%0A        //mapper.configure(DeserializationConfig.Feature.)%0A        try %7B%0A            User user = mapper.readValue(json,User.class);%0A            System.out.println(user.getName());%0A            //System.out.println(user.getAddress().getName());%0A        %7D catch (IOException e) %7B%0A            e.printStackTrace();%0A        %7D%0A        //%7B%22id%22:%221%22,%22name%22:%22zhuhh%22,%22address%22:%22%7B%22id%22:%22222%22,%22name%22:%22333%22%7D%22%7D%0A    %7D%0A%0A%0A    //SerializationFeature%0A    @Data%0A    private final static class User%7B%0A        private String id;%0A        private String name;%0A%0A        //@JsonDeserialize(contentUsing=StringToObject.class)%0A        private Address address;%0A%0A    %7D%0A%0A    @Data%0A    private final static class Address%7B%0A%0A        @JsonCreator%0A        public Address(String id)%7B%7D%0A%0A        private String id;%0A        private String name;%0A%0A    %7D%0A%0A%0A    public static class StringToObject extends JsonDeserializer%3CAddress%3E %7B%0A%0A        @Override%0A        public Address deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException %7B%0A            Address address = jp.readValueAs(Address.class);%0A%0A            return address;%0A        %7D%0A    %7D%0A%0A%7D%0A

test mapper 测试