其他分享
首页 > 其他分享> > Lombok使用

Lombok使用

作者:互联网

1.在IDEA中安装lombok插件
2.在项目中导入lombok的jar包

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.18.18</version>
        </dependency>

3.在实体类上面加注解即可

@Getter and @Setter
@FieldNameConstants
@ToString
@EqualsAndHashCode
@AllArgsConstructor, @RequiredArgsConstructor and @NoArgsConstructor
@Log, @Log4j, @Log4j2, @Slf4j, @XSlf4j, @CommonsLog, @JBossLog, @Flogger, @CustomLog
@Data
@Builder
@SuperBuilder
@Singular
@Delegate
@Value
@Accessors
@Wither
@With
@SneakyThrows
@val
@var

说明:

@DATA无参构造,get,set,toString,hashcode,equals
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode
@ToString

标签:EqualsAndHashCode,插件,NoArgsConstructor,AllArgsConstructor,ToString,使用,Lombok,lom
来源: https://www.cnblogs.com/UltraBlast/p/14610381.html