스프링
[자바] Lombok - 부모클래스의 toString 호출하기
imcoding
2022. 11. 17. 00:42
매우 간단하므로 두 단계로 끝내겠다.
부모클래스에 ToString 어노테이션 선언
@Getter
@MappedSuperclass
@ToString
public abstract class BaseEntity {
private LocalDateTime createdAt;
private LocalDateTime modifiedAt;
}
자식 클래스에 callSuper 설정
@ToString(callSuper = true)
public class Customer extends BaseEntity {
private Long id;
}
디폴트는 false 이다.