1.在pom.xml文件里导入包
org.projectlombok
lombok
1.18.4
provided
```
2。编写实体类
package entity;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.Id;
import javax.persistence.Table;
@Table(name = “userinfo”)
@Setter
@Getter
public class UserDTO{
@Id
private Integer uid;
private String username;
private Integer age;
private String sex;
private String nation;
private String motion;
private String food;
private Double consume;
private Double balance;
@Override
public String toString() {
return "UserInfo{" +
"uid=" + uid +
", username='" + username + '\'' +
", age=" + age +
", sex='" + sex + '\'' +
", nation='" + nation + '\'' +
", motion='" + motion + '\'' +
", food='" + food + '\'' +
", consume=" + consume +
", balance=" + balance +
'}';
}
【java|使用lombok包可以将实类的get/set方法省略】}
推荐阅读
- Java|Java基础——数组
- 人工智能|干货!人体姿态估计与运动预测
- java简介|Java是什么(Java能用来干什么?)
- Java|规范的打印日志
- Linux|109 个实用 shell 脚本
- 程序员|【高级Java架构师系统学习】毕业一年萌新的Java大厂面经,最新整理
- Spring注解驱动第十讲--@Autowired使用
- SqlServer|sql server的UPDLOCK、HOLDLOCK试验
- jvm|【JVM】JVM08(java内存模型解析[JMM])
- 技术|为参加2021年蓝桥杯Java软件开发大学B组细心整理常见基础知识、搜索和常用算法解析例题(持续更新...)