An error occurs when @Builder and @NoArgsConstructor are used together as shown below.
@Builder
@NoArgsConstructor
public class MyName {
private String first;
private String last;
}
You can do this by including the @AllArgsConstructor annotation or by adding a constructor with all fields.
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class MyName {
private String first;
private String last;
}
..Or..
@Builder
@NoArgsConstructor
public class MyName {
private String first;
private String last;
MyName(String first, String last) { ... }
}
Recommended Posts