Error while extracting response for type[接收的response实体类] and content type [application/json;charset=UTF-8];.........JSON parse error:Connot construct instance of ‘接受收的实体类responseDTO’ (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value(‘fail’);.........
!!!这个错误是因为Json转换成对象失败了,虽然responseDTO有一个构造器,但默认的是无参构造器,此时没办法解析服务端传来的单个字符串。
!!!原因是responseDTO里边缺少了一个只有一个String类型参数的构造器,导致在解析 ’fail’的时候失败了,需要在responseDTO里边创建一个构造方法,来接收字符串:‘fail’
例: public responseDTO(String args1){ //args1参数名任意取
this.args1=args1;
}