@RequiredArgsConstructor
final이나 @NonNull인 필드 값만 파라미터로 받는 생성자를 추가
import lombok.RequiredArgsConstructor;
@RequiredArgsConstructor
public class Person {
private final String name;
private final int age;
private String address;
}
public class Main {
public static void main(String[] args) {
Person person1 = new Person("John", 30);
}
}
https://standout.tistory.com/176
https://standout.tistory.com/495
'JAVA > Spring' 카테고리의 다른 글
Annotation - @RequestBody @ResponseBody (0) | 2023.05.10 |
---|---|
Annotation - @ResponseEntity (0) | 2023.05.10 |
Annotation - @NonNull (0) | 2023.04.20 |
Annotation - @Data (0) | 2023.04.20 |
Annotation - @AllArgsConstructor (0) | 2023.04.20 |