Cannot construct instance of - Jackson

后端 未结 5 1798
北恋
北恋 2020-12-01 05:11

I am using Jackson and I\'m having problems, when I try to deserialize an Object I get the following error:

com.fasterxml.jackson.databind.JsonMappingExcepti         


        
5条回答
  •  孤城傲影
    2020-12-01 05:21

    For me there was no default constructor defined for the POJOs I was trying to use. creating default constructor fixed it.

    public class TeamCode {
    
        @Expose
        private String value;
    
        public String getValue() {
            return value;
        }
    
        **public TeamCode() {
        }**
    
        public TeamCode(String value) {
            this.value = value;
        }
    
        @Override
        public String toString() {
            return "TeamCode{" +
                    "value='" + value + '\'' +
                    '}';
        }
    
        public void setValue(String value) {
            this.value = value;
        }
    
    }
    

提交回复
热议问题