화면에서 넘어오는 객체 매핑을 못하는것 같다.

화면의 기간날짜 폼 데이터를 문자열로 받아오는 과정에서 setter를 재정의 하여 

시작일자, 종료일자 정보에 매핑하여 처리하려 했는데, 오류가 발생했다.

{"MAASLOG"="[2022-10-22 23:52:04][WARN ][http-nio-8082-exec-10][AbstractHandlerExceptionResolver.java:207][logException:Resolved [org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 2 errors
Field error in object 'batchErrorCollectFormDto' on field 'endDttm': rejected value [null]; codes [typeMismatch.batchErrorCollectFormDto.endDttm,typeMismatch.endDttm,typeMismatch.java.lang.Long,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [batchErrorCollectFormDto.endDttm,endDttm]; arguments []; default message [endDttm]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'java.lang.Long' for property 'endDttm'; nested exception is java.lang.NumberFormatException: For input string: "null"]
Field error in object 'batchErrorCollectFormDto' on field 'startDttm': rejected value [null]; codes [typeMismatch.batchErrorCollectFormDto.startDttm,typeMismatch.startDttm,typeMismatch.java.lang.Long,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [batchErrorCollectFormDto.startDttm,startDttm]; arguments []; default message [startDttm]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'java.lang.Long' for property 'startDttm'; nested exception is java.lang.NumberFormatException: For input string: "null"]]]"}

 

Field error in object 'batchErrorCollectFormDto' on field 'endDttm': rejected value [null]; 
codes [typeMismatch.batchErrorCollectFormDto.endDttm,typeMismatch.endDttm,typeMismatch.java.lang.Long,typeMismatch]; 
arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [batchErrorCollectFormDto.endDttm,endDttm]; 
arguments []; 
default message [endDttm]]; 
default message [Failed to convert property value of type 'java.lang.String' to required type 'java.lang.Long' for property 'endDttm'; 
nested exception is java.lang.NumberFormatException: For input string: "null"]

 

null이 들어왔다고 까인듯 하다.

그래, 이전 화면에서는 화면을 먼저 구성하느라 null 은 들어오지 않았던것 같다. 

테스트로 요청케이스를 만들거나, 다시 화면부터 작업해야겠다. 

 

https://noritersand.github.io/spring/spring-org-springframework-validation-bindexception/

 

[Spring] org.springframework.validation.BindException

띠용

noritersand.github.io

 

+ Recent posts