Lombok 라이브러리

[Java] Lombok 라이브러리 설치와 활용
Jan 12, 2024
Lombok 라이브러리
💡
자동으로 실행 시 Getter, Setter등을 생성(어노테이션)

세팅 방법

1. 라이브러리 설치

notion image

2. Marketplace에서 Lombok Install

notion image
코드상에 Getter가 없으면 오류가 남 → Tool에게 오류가 아닌걸 이해시켜주기 위해 설치

활용

notion image
class 위에 @Getter를 입력
실행 전 Getter가 없어도 실행 시 Getter를 생성해냄
@Data : Getter, Setter 생성
@Setter : Setter 생성
@AllArgsConstructor // 모든 인수를 다 받는 생성자 생성
@NoArgsConstructor // 기본 생성자 생성
 
Share article
RSSPowered by inblog