Why Use Lombok?

To reduce boilerplate code in the entities layer (and other Java classes, such as POJOs or DTOs), you can add Lombok annotations. These annotations generate repetitive code (e.g., getters, setters, constructors) at compile time, making the code cleaner and more maintainable.

Good Reference: https://www.baeldung.com/intro-to-project-lombok

What is Lombok?

Lombok is a helper third-party library designed to reduce boilerplate code in Java classes, particularly in the POJO layer (e.g., entities, DTOs), by using annotations. It generates code for common tasks (e.g., constructors, getters/setters, toString, equals, hashCode) during compilation, improving developer productivity and code readability.

Steps to Use Lombok

  1. Add Lombok Dependency in pom.xml:

    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <version>1.18.34</version> <!-- Use the latest version, e.g., 1.18.34 -->
        <scope>provided</scope>
    </dependency>
    
    
  2. Install Lombok Library to IDE:

  3. Maven Force Update and Cleaning:

  4. Use Lombok Annotations:

Lombok Annotations