I\'m using project Lombok together with Spring Data JPA.
Is there any way to connect Lombok @Builder with JPA default constructor?
Code:
Using @NoArgsConstructor and @AllArgsContructor will help solve the issue of having a default constructor with @Builder.
e.g
@Entity
@Builder
@NoArgsConstructor
@AllArgsContructor
class Person {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
}
This is because @Builder requires all argument constructor and specifying only a default constructor will cause an issue.
Here is nore explaination: https://github.com/rzwitserloot/lombok/issues/1389#issuecomment-369404719