问题
I have gradle spring boot project and I added Lambok dependency in build.gradle. I created one model class and want to use lombok. I have added @Data annotation but still setter and getter methods are not generated. Sample code :
import lombok.Data;
@Data
public class TestLambok {
private int id;
private String name;
private String summary;
}
回答1:
For use Lombok Plugin, you need the following steps (at least on IntelliJ):
- Install Lombok Plugin
- Enabling Annotation Processing
- Restart IDE
For more information you can read this post: https://www.baeldung.com/lombok-ide
回答2:
Install the Lombok plugin first then you can use the @Data annotation. Please note that you won't physically see the getters, setters and toString() appear in your class aktjouy Lombok will create it
来源:https://stackoverflow.com/questions/60596222/lombok-does-not-create-getter-and-setter-methods-after-using-data