티스토리 뷰
개발/Spring
[Spring] - @Builder will ignore the initializing expression entirely. If you want the initializing expression to serve as default, add @Builder.Default. If it is not supposed to be settable during building, make the field final.
dongdev 2022. 10. 2. 01:30lombok의 @Builder 어노테이션을 클래스단위에 사용한 어플리케이션을 빌드 할때 발생.
에러내용:
@Builder will ignore the initializing expression entirely. If you want the initializing expression to serve as default, add @Builder.Default. If it is not supposed to be settable during building, make the field final.
-> @Builder는 초기화 표현을 다 무시한다. 초기화 하고싶으면 @Builder.Default 나 final 필드로 선언해라.
해결:
final 필드로 선언하면 수정이 불가하니 초기화 대상 필드마다 @Builder.Defalut를 추가해줬다.
참고:
클래스 단위에 @Builder 사용은 지양하자.
클래스 단위에 @Builder를 달아주면 @AllArgsConstructor도 같이 달아주는 것과 같기 때문에 가급적 직접 생성한 생성자에 달아주자.
'개발 > Spring' 카테고리의 다른 글
[Spring] - HttpMessageConverter (0) | 2022.10.26 |
---|---|
[Spring] - Spring Boot, Jboss 개발환경 구축하기 (0) | 2022.10.03 |
[Spring] - profile 환경별 설정하기(YAML) (0) | 2022.07.29 |
[Spring] - Spring AOP 사용 시 주의사항 (0) | 2022.07.24 |
[Spring] - 스프링에서 자주보이는 xxxTemplate (0) | 2022.07.20 |