Amol
Amol

Reputation: 51

Lombok does not create getter and setter methods after using @Data

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;

}

Upvotes: 3

Views: 11475

Answers (3)

PowerMan2015
PowerMan2015

Reputation: 1418

Im using visual studio code. There is an extension called "Lombok Annotations Support for VS Code".

Installing this allowed the auto generated methods to show when querying the properties of the object

Upvotes: 0

Coder
Coder

Reputation: 235

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

Upvotes: 1

Sergio Puas
Sergio Puas

Reputation: 483

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

Upvotes: 5

Related Questions