一、安装插件
File–Settings–Plugins
搜索Lombok,点击install之后,重启IDEA即可使用。
二、配置注解处理器
IDEA也会自动提示,注意右下角提示
File–Settings–Build,Execution,Deployment
Compiler–Annotation Processors,选中Enable annotation processing
三、引入jar包(maven项目)
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.12</version>
<scope>provided</scope>
</dependency>
四、注解使用
官网介绍链接:
https://objectcomputing.com/resources/publications/sett/january-2010-reducing-boilerplate-code-with-project-lombok