com.fasterxml.jackson.databind.JsonMappingException: No suitable constructor
com.fasterxml.jackson.databind.JsonMappingException: No suitable constructor
·
java报错:com.fasterxml.jackson.databind.JsonMappingException: No suitable constructor
解决:加上static就好
示例代码:
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.ArrayList;
import java.util.List;
@JsonIgnoreProperties(ignoreUnknown = true)
@Data
@Accessors(chain = true)
public class QueryEniResponse {
private String eniId;
private String name;
private String vpcId;
private String subnetId;
private String zoneName;
private String description;
private String createdTime;
private String macAddress;
private String status;
private String networkInterfaceTrafficMode;
private List<PrivateIpItem> privateIpSet = new ArrayList<>();
private List<String> securityGroupIds = new ArrayList<>();
private List<String> enterpriseSecurityGroupIds = new ArrayList<>();
@JsonIgnoreProperties(ignoreUnknown = true)
@Data
@Accessors(chain = true)
public static class PrivateIpItem{
private Boolean primary;
private String privateIpAddress;
private String publicIpAddress;
}
}
更多推荐
已为社区贡献1条内容
所有评论(0)