Mybatis-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.
使用步骤
-
在IDEA中安装Lombok插件
-
在项目中导入lombok的jar包
<dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>1.18.22</version> </dependency>
-
在实体类上加上注解即可!
-
获取get和set方法
@Getter and @Setter
-
tostring方法
@ToString
-
equals和hashcode方法
@EqualsAndHashCode
-
有参构造
@AllArgsConstructor
-
无参构造
@NoArgsConstructor
-
无参构造,tostring和hashcode方法
@Data
-