java - 不能在类上使用 lombok @NoArgsConstructor
问题描述
我将 Jackson 用作 Json 解析器,但出现错误:
No suitable constructor found for type ~ can not instantiate from JSON object
所以我尝试添加@NoArgsConstructor
,但现在我得到了这个:
constructor AccountItem in class AccountItem cannot be applied to given types
这是我的课:
@Getter
@Builder
public class AccountItem {
/**
* Accounti dentifier
*/
private Long accountId;
/**
* Account name
*/
private String accountName;
/**
* Account priority
*/
private int accountPriority;
}
可能是什么原因?
解决方案
向您的班级添加@AllArgsConstructor
和@NoArgsConstructor
注释
推荐阅读
- python - 将玩家放置在棋盘上并在 Python 中移动它们
- kubernetes - Kubernetes Cloud Logging 身份验证问题
- html - HTML 电子邮件签名不向下移动
- azure - 不填充 Azure 顾问 REST API 建议扩展属性?
- c# - c# - iTextSharp - 无法访问关闭的流
- r - 在R中将数据框转换为json对象时如何创建嵌套结构
- sql - 选择一个表,其中表名存储在另一个表中
- javascript - Vue,从axios结果中检查模态中的预渲染复选框
- google-sheets - 在基于范围的下拉列表中格式化日期
- tensorflow - 为 Jetson Nano 上的 TensorRT 转换 TF 2.0 保存的模型