当前位置:网站首页>使用Lombok导致打印的tostring中缺少父类的属性
使用Lombok导致打印的tostring中缺少父类的属性
2022-07-27 14:24:00 【合格的程序员】

@Data
public class User extends BaseEntity {
/**
* 姓名
*/
@TableField("name")
private String name;
/**
* 密码
*/
@TableField("password")
private String password;
/**
* 性别
*/
@TableField("sex")
private String sex;
/**
* 年龄
*/
@TableField("age")
private Integer age;
/**
* 邮箱
*/
@TableField("email")
private String email;
/**
* 排序
*/
@TableField("sort")
private Integer sort;
图中打印内容只包含子类属性,却不包含父类BaseEntity的属性,此处@Data修饰,此注解包含了getter,setter,tostring,所以此处的tostring如果不设置参数的话,打印string的时候只会包含子类的属性,解决:在@Data的基础上再加一个@ToString(callSuper = true)注解,callSuper = true即解决缺少父类属性的问题。
边栏推荐
- 【剑指offer】面试题50:第一个只出现一次的字符——哈希表查找
- Leetcode 190. reverse binary bit operation /easy
- 【剑指offer】面试题56-Ⅰ:数组中数字出现的次数Ⅰ
- 《剑指Offer》剪绳子
- Tools - common methods of markdown editor
- Is it safe to open an account on a mobile phone?
- Google team launches new transformer to optimize panoramic segmentation scheme CVPR 2022
- Pictures to be delivered
- 《剑指Offer》 链表反转
- Huawei's general card identification function enables multiple card bindings with one key
猜你喜欢

【剑指offer】面试题49:丑数

STL value string learning

Record record record

复杂度分析

EMC design scheme of RS485 interface

Spark 3.0 DPP实现逻辑

Unity性能优化------渲染优化(GPU)之Occlusion culling(遮挡剔除)
仪表放大器和运算放大器优缺点对比

Leetcode-1737-满足三条件之一需改变的最少字符数

Leetcode-1737- minimum number of characters to change if one of the three conditions is met
随机推荐
Huayun data creates a perfect information technology and innovation talent training system to help the high-quality development of information technology and innovation industry
Spark 3.0 DPP实现逻辑
Comparison of advantages and disadvantages between instrument amplifier and operational amplifier
EMC design scheme of CAN bus
HaoChen CAD building 2022 software installation package download and installation tutorial
Unity performance optimization ----- LOD (level of detail) of rendering optimization (GPU)
QT (five) meta object properties
3D相关的简单数学知识
Huawei's general card identification function enables multiple card bindings with one key
《剑指Offer》 合并两个排序的链表
Network equipment hard core technology insider router Chapter 18 dpdk and its prequel (III)
EMC design scheme of USB2.0 Interface
reflex
Dan bin Investment Summit: on the importance of asset management!
Leetcode-1737- minimum number of characters to change if one of the three conditions is met
Several basic uses of tl431-2.5v voltage reference chip
Two stage submission and three stage submission
multimap案例
STM32 can communication filter setting problem
后台返回来的是这种数据,是什么格式啊