前提:
gradle springboot项目
解决:
-
配置Plugins中安装lombok;
-
配置中打开annotation processing:
Build, Execution, Deployment -> Compiler -> Annotation Processors -> Enable annotation processing -
build.gradle中添加:
implementation ‘org.projectlombok:lombok:1.18.20’
annotationProcessor ‘org.projectlombok:lombok:1.18.20’
(这里注意:annotationProcessor这一行一定要;两行中的版本要一样)