In short, use @AllArgsConstructor
to generate a constructor for all of your class’s fields and use @RequiredArgsConstructor
to generate a constructor for all class’s fields that are marked as final.
From the documentation,
@AllArgsConstructor
generates a constructor with 1 parameter for each field in your class.
@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.