강의

멘토링

커뮤니티

인프런 커뮤니티 질문&답변

David Byun님의 프로필 이미지
David Byun

작성한 질문수

스프링 MVC 2편 - 백엔드 웹 개발 활용 기술

Bean Validation - 시작

Item class 에 public Item() 역할

작성

·

351

0

public Item(){

} 은 왜 생성하는지 질의드립니다.

Item.java

@Data
public class Item {

    private Long id;
    private String itemName;
    private Integer price;
    private Integer quantity;

    public Item() {
    }

    public Item(String itemName, Integer price, Integer quantity) {
        this.itemName = itemName;
        this.price = price;
        this.quantity = quantity;
    }
}

 

답변 1

0

안녕하세요. David Byun님, 공식 서포터즈 OMG입니다.
.

기본 생성자를 지웠을 때 발생하면 오류가 발생할 것입니다.

오류 원인을 알기 어려우실 경우

아래 링크 혹은 다른 학습 매체등을 참고하여 생성자를 학습해주세요.

https://miyakita.tistory.com/202


.
감사합니다.

David Byun님의 프로필 이미지
David Byun

작성한 질문수

질문하기