Skip to content

Instantly share code, notes, and snippets.

@kjivan
Last active February 14, 2024 00:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kjivan/a34311e206ce0e3a3e2b5e3f8f594517 to your computer and use it in GitHub Desktop.
Save kjivan/a34311e206ce0e3a3e2b5e3f8f594517 to your computer and use it in GitHub Desktop.
Lombok Best Practices

Lombok Best Practices

Entities

DTOs/POJOs/Classes with just member variables to store data

Services

  • Use @RequiredArgsConstructor
    • Make dependency injected class variables private final
      • This makes them required cuasing them to be included in the constructor and therefore injection
    • Make @Value class variables private
      • These values are not constuctor injected
  • Do not use @Data , @Getter , @Setter data in services should not be used by anyone else
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment