Steps to use Lombok
Introduction to Lombok
Project Lombok is a java library that can be automatically inserted into editors and build tools to enhance the performance of java. No need to write getters, setters or equals methods anymore, just one annotation and your class has a fully functional builder, automatically documented variables and more.
When not using lombok, how to use it (IDEA):
Handwritten or automatically generated, get, set, ToString methods, etc.
private int id;
private String uerName;
private String passWord;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getUerName() {
return uerName;
}
public void setUerName(String uerName) {
this.uerName = uerName;
}
public String getPassWord() {
return passWord;
}
public void setPassWord(String passWord) {
this.passWord = passWord;
}
And then we can greatly reduce the manual operation by using the Lombok plug-in, just use the @Data annotation
@Data
public class User {
private int id;
private String uerName;
private String passWord;
Second, the installation of Lombok
First install the Lombok plugin in the idea File —> Settings —> Plugins —> Browse repositories —> Search for lombok
Don't forget to add related dependencies to the project pom.xml afterwards
```java<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
</dependencies>