Lombok @Getter(lazy=true) Annotation | Lazy Getter

In @Getter  When lazy set to true, it is possible to delay the initialization of the value until the getter method is called first.

package sample.lombok;import lombok.Getter;public class Main {    public static void main(String[] args) {        Main m = new Main();        System.out.println("Main instance is created");        m.getLazy();    }    @Getter    private final String notLazy = createValue("not lazy");    @Getter(lazy=true)    private final String lazy = createValue("lazy");    private String createValue(String name) {        System.out.println("createValue(" + name + ")");        return null;    }}
Execution result
createValue(not lazy)Main instance is createdcreateValue(lazy)