IDEA plug-ins add Lombok

background:

  Boss gave a recent project, she is a child. A look entity class ignorant force, no getter, setter and construction methods, resulting in full-service and controller reported the red line, private property also has no comment. Outlaw, was the first senior call 10 times, and then a look @author xx. This is not my boss thing? Then try to start the project, FML, actually be able to start, after the entity classes went to see the compiler and saw a variety of configurations and getter, setter, etc. are all generated good, and blinded. A Google search, the original Lombok this thing up to no good.

  Look at how the official website said: 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 is translated down:. Lombok is a java library that can automatically insert editor and build tools, add color to your java. Never write or equals another getter method, a comment, you have a fully functional class builder, automate your logging variables, and so on.

  As the project entity class using the scope @Data @NoArgsConstructor @AllArgsConstructor belong LomBok used, the compiler automatically generates a time series method entity classes, though nothing was wrong, but the project reported to the red line, and code intelligence and padded tips no, this I can not endure.

First to introduce common comment:

@NoArgsConstructor: no parameter automatically generated constructor.

@AllArgsConstructor: automatically generate a full-argument constructor.

@Data: automatically added @ToString, @EqualsAndHashCode, @Getter method for all fields, adding a non-final fields @Setter, and @RequiredArgsConstructor

More specific use and can be explained to the official website to find, you can also refer to https://blog.csdn.net/maslii/article/details/81582963 .

How to solve the red line and can not code hinting problem?

IDEA plug-in installation Lombok

1, Ctrl + Alt + S to open the Settings option

2, Ctrl + Alt + S to open the Settings option, search Annotation Processors, select the Enable annotation processors, enable annotation processor

3, restart Editor

4, I write to you I have done the above steps, but has not been tested, regardless of the first release. If there are problems, then I would change, no problem not changed.

Reference: https://www.projectlombok.org/

 

Guess you like

Origin www.cnblogs.com/yzp666/p/10973444.html