IDEA simplifies the preparation of an entity class to use plug-ins Lombok

Version: IDEA Community 2019.2.2

Process: Install lombok plug-in and install, restart = "join in the pom file

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
=》新建一个类
Article {class public 
Private Long Id;
Private the Name String;
}
= "to annotate Article: @AllArgsConstructor, it indicates a class has a constructor configured with all member variables
@AllArgsConstructor 
public class Article This article was {
Private Long Id;
Private String the Name;
}
= "instantiation: Article This article was Article This article was = new new Article This article was (1L," Maycpou ");
=" Of course there are many other annotations can help us, such as:
@ NoArgsConstructor, expressed a constructor with no arguments;
@Data, to the entity classes get / set methods, ToString method plus;
@Builder, instances can be created using this approach:. article = Article.builder () Id (1L .) .Name ( "Maycpou") Build ();
=> @ SLF4J, can be directly added to the annotated classes used log.info () "Come Come!" ; write log format

Guess you like

Origin www.cnblogs.com/maycpou/p/11567866.html