1、File-Settings-Plugins-Brows Repositories-输入lombok-install
2、重启idea
3、添加maven依赖
4、用法
看下官方Features
@Getter and @Setter
@FieldNameConstants
@ToString
@EqualsAndHashCode
@AllArgsConstructor, @RequiredArgsConstructor and @NoArgsConstructor
@Log, @Log4j, @Log4j2, @Slf4j, @XSlf4j, @CommonsLog, @JBossLog, @Flogger
@Data
@Builder
@Singular
@Delegate
@Value
@Accessors
@Wither
@SneakyThrows
from Intellij 14.1 @val
from Intellij 15.0.2 @var
from Intellij 14.1 @var
from Intellij 2016.2 @UtilityClass
Lombok config system
Code inspections
Refactoring actions (lombok and delombok)
我们最关注的的几个注解:
_@Getter _@Setter _@ToString _@AllArgsConstructor,这4个注解直接用@Data____即可
@Slf4j,_____省去之前用的_____Logger.getLogger(LogExample.class.getName());
@Builder 返回每个属性值的Builder,不用自己再去实现
使用此插件后,一个普通的Bean至少减少一半的代码量,出错几率也大大降低,pick用起来