Installation and use of IDEA plug-in Lombok

  The advantage of this plugin is that it can make our code more concise, reduce some duplication of work, the most commonly used is @Data annotations, such as the use @Data annotation on the entity class, each class of property of an entity is not required to write the get and set methods .

 

installation method:

1, File → Settings → Plugins, enter mybatis plugin, never found locally, you can click Search in repositories (or click Browse repositories into the search), select Install installation can be found to Free MyBatis plugin, the need to restart after installation IDEA.

 

Instructions:

  After installation, you can use directly in the form of annotations. Such as the use @Data annotation, a new User entity class, and then directly in front of the class with @Data annotation this way, the entity class attribute does not need to get and set methods, and as shown below:

 

There are some of the more commonly used annotation, such as:

@AllArgsConstructor  added to the class, it can be configured to generate full-containing entity class parameter.

@NoArgsConstructor   applied on a class may be generated constructor with no arguments.

@RequiredArgsConstructor   added to the class, with the use of annotations @NonNull generated constructor specified parameters. Such as adding annotations in front @NonNull age attribute, the User generates a parameter configuration method requires age.

@Getter   added to the class, the entity class may be generated for all the getter properties.

@Setter   added to the class, the entity class may be generated setter methods for all properties.

@ToString   added to the class, calling toString () method, the output values of all attributes entity class.

 

Guess you like

Origin www.cnblogs.com/pcheng/p/10945476.html