티스토리 뷰

nested exception is org.apache.ibatis.reflection.ReflectionException: Error instantiating class 객체명 with invalid types () or values (). Cause: java.lang.NoSuchMethodException: 객체명 <init>()

 

Mybatis에서 객체를 매핑할때 발생하는 에러로 기본생성자가 없으면 발생하는 에러이다.

 

setter와 AllargsConstructor의 존재와 상관없이 Mybatis에서 조회 후 객체를 매핑할때 빈 생성자를 반드시 만들어줘야한다.

 

Lombok을 사용중이면 @NoArgsConstructor 설정해주면 된다.

@Builder
@Getter @Setter
@AllArgsConstructor
@NoArgsConstructor
public class 객체명 {
	private String ...
}

 

공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/10   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
글 보관함