Lombok's official website: http://projectlombok.org/
1. Installation of Lombok :
The use of Lombox is required to install, if not installed, the IDE will not be able to parse Lombox annotations, there are two ways to install Lombok;
①. In the command line to execute the Java-jar Lombox.jar package location, for example: Java-jar d:/lombok.jar pop-up Select the IDE installation path of the prompt box, select the IDE's installation path, click Install/update to install. After the installation is complete, the installation directory for Eclipse has a Lombok.jar package, and the following two lines in Eclipse.ini indicate that the installation was successful.
②. The second way to install is to manually install the Lombok.jar package into the installation directory of Eclipse, and add the following two lines to the Eclipse.ini file.
-xbootclasspath/a:lombok.jar --Note: It's no problem if you don't have this line-javaagent:lombok.jar
Restart Eclipse. But in your project you want to Lombok the annotations to take effect, you also need to add Lombok.jar to your project, if it is a MAVEN project, the following code is added to the pom file:
<Dependency> <groupId>Org.projectlombok</groupId> <Artifactid>Lombok</Artifactid> <version>1.16.12</version> <Scope>Provided</Scope></Dependency>
2. Lombok Annotations
Lombok Annotations Online Help documentation: Http://projectlombok.org/features/index.
Common annotations:
@Data: Annotations are on classes, provide getting and setting methods for all properties of a class, and also provide equals, canequal, Hashcode, toString methods
@Setter: Annotations on attributes; providing setting methods for attributes
@Getter: Annotations on attributes; providing getting methods for attributes
@Log4j: Annotations are on a class, and a log4j log object with a property named log is provided for the class
@NoArgsConstructor: Annotations on a class, providing an argument-free construction method for a class
@AllArgsConstructor: Annotations are on a class, and a method for constructing a class with full parameters
(EXT) Eclipse installation Lombok