[Spring Boot] Lombok @Getter Boolean 타입

sy·2022년 12월 7일

Entity에 Boolean 타입 선언

@Column(columnDefinition = "tinyint(1) default 1")
private boolean status;

Entity에 Boolean 타입을 선언 후 @Getter를 이용하여 다른 타입처럼 get을 사용하니 오류가 났습니다.

아래와 같이 롬복 문서를 따르면,

A default getter simply returns the field, and is named getFoo if the field is called foo (or isFoo if the field's type is boolean).
https://projectlombok.org/features/GetterSetter

boolean 타입일 경우 is를 사용하라고 나와있습니다.

getStatus() -> isStatus()로 변경함으로써 오류를 해결하였습니다.

0개의 댓글