Lombok @RequiredArgsConstructor Annotation explained

@RequiredArgsConstructor generates a constructor with 1 parameter for each field that requires special handling. All non-initialized final fields get a parameter, as well as any fields that are marked as @NonNull that aren’t initialized where they are declared. For those fields marked with @NonNull, an explicit null check is also generated. The constructor will throw a NullPointerException if any of the parameters intended for the fields marked with @NonNull contain null. The order of the parameters match the order in which the fields appear in your class.

Point to be Noted:

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

package sample.lombok;import lombok.RequiredArgsConstructor;@RequiredArgsConstructorpublic class Main {    private String optional;    private final int required;}

@RequiredArgsConstructor
@RequiredArgsConstructor