In spring Lombok's annotations are not effective(maybe this is the bug)

44 Views Asked by At

Mycode:

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class CallResult<T> implements Serializable {

    private int code;

    private String message;

    private T result;
    

    public static <T>CallResult<T> success() {
        return new CallResult<T>(200, "default success", null);
    }
}

My dependency:

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.18.24</version>
        </dependency>

JDK: enter image description here

Error Info: enter image description here

I learned that using annotations in Lombok can reduce some redundant code, such as constructors, get and set methods, etc

But after I added the annotation, it prompted me to add a constructor.

I thought it was a compatibility issue with the versions of jdk11 and lombok 1.18.20, but it is compatible.

Then I also opened the settings --> Enable annotation processing

I don't know how to solve this problem, please help me

0

There are 0 best solutions below