1、环境的搭建,在eclipse下的eclipse.ini中添加以下参数,

-Xbootclasspath/a:C:\repository\org\projectlombok\lombok\1.16.6\lombok-1.16.6.jar

-javaagent:C:\repository\org\projectlombok\lombok\1.16.6\lombok-1.16.6.jar

重启你的eclipse.


2、将lombok-1.16.6.jar引入你的项目中,例如maven项目中,在pomx.xml中引入如下:

<!-- lombox -->

<dependency>

<groupId>org.projectlombok</groupId>

<artifactId>lombok</artifactId>

<version>${lombok.version}</version>

<scope>provided</scope>

</dependency>

3、编写实体类就可以想下面这样省去set/get

package org.kiloseed.modules.sys.entity;


import java.util.Date;


import lombok.Data;


@Data

public class User {

    private Long id;


    private Long companyId;


    private Long officeId;


    private String loginName;


    private String password;


    private String no;


    private String name;


    private String email;


    private String phone;


    private String mobile;


    private String userType;


    private String loginIp;


    private Date loginDate;


    private Long createBy;


    private Date createDate;


    private Long updateBy;


    private Date updateDate;


    private String remarks;


    private String delFlag;

}

下面就可以使用了,只是减少了代码量

lombox的用法(省去了set/get/NoArgsConstructor/AllArgsConstructor)_lombok