InvalidDefinitionException: Cannot construct instance of Dto (no Creators, like default constructor, exist): cannot deserialize from Object value (no delegate- or property-based Creator)

CinnamonTree·2022년 1월 13일
0

코드 오류

목록 보기
1/3

"Type definition error: [simple type, class com.hri.hri_web_backend.dto.UpdateArticleRequestDto]; nested exception is com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of com.hri.hri_web_backend.dto.UpdateArticleRequestDto (no Creators, like default constructor, exist): cannot deserialize from Object value (no delegate- or property-based Creator)\n at [Source: (PushbackInputStream); line: 2, column: 5]"

DTO에 protected 생성자를 입력해주니 해결되었다.

@Getter
@Setter
public class UpdateArticleRequestDto {

    private String topic;
    private String content;
    private String author;

    //!!!!!!!!!!!!!!!!!!!!!!!!
    protected UpdateArticleRequestDto(){
    }
    
    @Builder
    public UpdateArticleRequestDto(String topic, String content, String author){
        this.topic = topic;
        this.content = content;
        this.author = author;
    }
}

0개의 댓글