<aside> 📝 공부 목차
</aside>
<aside> 💡 기억해야할 것
</aside>
위의 에러는, 기존에 boolean onOff
로된 필드를 LocationType locationType
으로 바꾼걸 인지 하지 못해서 request요청시 변수명이 잘못 돼서 나타난 에러다.
<aside> ⚠️ not-null 발생한 이유 → locationType이 NN 조건인데, request요청시 onOff로 잘못 요청해서 locationType을 추가하지 않았기 때문에 값이 없어서 발생한 오류 !
</aside>
그런데 필드를 제대로 바꿔줬더니 typeMismatch 에러가 발생했다..!
2021-12-02 14:54:24.382 WARN 21124 --- [nio-8080-exec-6] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 1 errors<LF>Field error in object 'challengeRequestDto' on field 'locationType': rejected value [true]; codes [typeMismatch.challengeRequestDto.locationType,typeMismatch.locationType,typeMismatch.shop.fevertime.backend.domain.LocationType,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [challengeRequestDto.locationType,locationType]; arguments []; default message [locationType]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'shop.fevertime.backend.domain.LocationType' for property 'locationType'; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.String] to type [shop.fevertime.backend.domain.LocationType] for value 'true'; nested exception is java.lang.IllegalArgumentException: No enum constant shop.fevertime.backend.domain.LocationType.true]]
원래는 요청을 onOff: true로 줬는데, Enum Type을 맞춰서 요청을 했어야 했다.
성공 🎉