当前位置:网站首页>使用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即解决缺少父类属性的问题。
边栏推荐
- Spark动态资源分配的资源释放过程及BlockManager清理过程
- Network equipment hard core technology insider router Chapter 7 tompkinson roaming the network world (Part 2)
- Design scheme of digital oscilloscope based on stm32
- Multi table query_ Sub query overview and multi table query_ Sub query situation 1 & situation 2 & situation 3
- Network device hard core technology insider router Chapter 15 from deer by device to router (Part 2)
- Cap theory and base theory
- Sword finger offer merges two sorted linked lists
- Two stage submission and three stage submission
- Leetcode 81. search rotation sort array II binary /medium
- 【剑指offer】面试题55 - Ⅰ/Ⅱ:二叉树的深度/平衡二叉树
猜你喜欢

Dan bin Investment Summit: on the importance of asset management!

Unity performance optimization ----- LOD (level of detail) of rendering optimization (GPU)

Unity 鼠标控制第一人称摄像机视角

DIY ultra detailed tutorial on making oscilloscope: (1) I'm not trying to make an oscilloscope

Leetcode 190. reverse binary bit operation /easy

Unity performance optimization ----- occlusion culling of rendering optimization (GPU)

【剑指offer】面试题50:第一个只出现一次的字符——哈希表查找

Spark TroubleShooting整理

Leetcode 781. rabbit hash table in forest / mathematical problem medium

复杂度分析
随机推荐
Spark动态资源分配的资源释放过程及BlockManager清理过程
EMC design scheme of USB2.0 Interface
Spark 3.0 Adaptive Execution 代码实现及数据倾斜优化
Four kinds of relay schemes driven by single chip microcomputer
DIY ultra detailed tutorial on making oscilloscope: (1) I'm not trying to make an oscilloscope
How to package AssetBundle
Spark 任务Task调度异常分析
《剑指Offer》数组中的逆序对
使用解构交换两个变量的值
Leetcode 783. binary search tree node minimum distance tree /easy
学习Parquet文件格式
魔塔项目中的问题解决
设置提示框位置随鼠标移动,并解决提示框显示不全的问题
微信公众平台开发概述
Unity性能优化------渲染优化(GPU)之LOD(Level of detail)
Selenium 报错:session not created: This version of ChromeDriver only supports Chrome version 81
Unity性能优化------渲染优化(GPU)之Occlusion culling(遮挡剔除)
Watermelon book machine learning reading notes Chapter 1 Introduction
DevEco Studio2.1运行项目报错
Spark3中Catalog组件设计和自定义扩展Catalog实现