Json데이터를 model데이터로 변환할때
no suitable constructor found for type 해당에러가 발생하는데
이유가 되는 좋은 블로그 공유
이유인 즉,
Hoge hello = mapper.readValue(json, Hello.class);
json데이터가 위의 class로 맵핑되는 시점에
해당 메소드를 호출하면서
default constructor를 호출하게 되는데
없으면 위와같은 에러가 발생하는것!!!
[Solved]: com.fasterxml.jackson.databind.JsonMappingException: No suitable constructor found for type [simple type, class sample
Solution: Please do not forget to add a default constructor in POJO class, otherwise you will get this error: Instead of this: public class Hollo { public int id; public…
interviewbubble.com
'IT > 개발' 카테고리의 다른 글
spring 파일 다운로드 (0) | 2020.10.28 |
---|---|
spring 파일 업로드 (0) | 2020.10.27 |
spring junit test (0) | 2020.10.16 |
JAVA 상대경로 (0) | 2019.12.02 |
JAVA 입력과 출력 stream (0) | 2019.10.19 |