Mybatis -> 8. Lombok简单使用
8.1 Lombok?
Project Lombok is a java library that automatically plugs into your editor and build tools, spicing up your java. Never write another getter or equals method again, with one annotation your class has a fully featured builder, Automate your logging variables, and much more.
8.2 使用
-
IDEA安装Lombok插件;
-
导入lombok的jar包;
<dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>1.18.22</version> </dependency>
-
在实体类上添加所需注解
@Data @AllArgsConstructor @NoArgsConstructor @ToString public class User { private int id; private String name; private String password; }