Lombok: RequiredArgsConstructor not working

后端 未结 5 1163
逝去的感伤
逝去的感伤 2021-01-01 12:49

It seems that @RequiredArgsConstructor not working in the code below. Why is it?

import java.io.Serializable;

import lombok.Data;
import lombok         


        
5条回答
  •  余生分开走
    2021-01-01 13:37

    According to Documentation, Required arguments are final fields and fields with constraints such as @NonNull.

    You need to make username as @NonNull

    @NonNull private String username;
    

    And you need to make them final too.

提交回复
热议问题