Niraj Singh
Niraj Singh

Reputation: 45

why I am not able to access the get and set method using @Getter and @Setter Annotation in Spring Boot Application? || Lombok

why I am not able to access the get and set method using @Getter and @Setter Annotation in Spring Boot Application?

    import lombok.Getter;
    import lombok.Setter;

public class Card {
    
    @Getter//(lazy = true) 
    @Setter
    private int id;
    @Getter
    @Setter
    private String cardvalue;

}

In my Controller class it says both methods are undefined. Note: In pom.xml added Lombok dependency

<dependency>
    <groupId>org.projectlombok</groupId>
    <artifactId>lombok</artifactId>
    <version>1.18.16</version>
    <scope>provided</scope>
</dependency>

and verified as well whether file downloaded successfully in Maven Dependencies or not.

Is there any configuration to do in order use that methods using annotation? please help!

Upvotes: 1

Views: 5397

Answers (2)

Sibin Muhammed A R
Sibin Muhammed A R

Reputation: 1432

I faced the same issue, Maybe you need to add one Lombok plugin, that will fix the issue at least for me or others

Could you please refer the below pages? And follow the steps to add the Lombok plugin

Solution 1

Solution 2

Solution 3

Please refer IntelliJ

Please refer Eclipse/STS

Upvotes: 0

burm87
burm87

Reputation: 848

If you are on IntelliJ you need to download the Lombok plugin. You can download it from Preferences -> Plugins -> Lombok enter image description here

Upvotes: 3

Related Questions