강사님 현재 등록하는 부분에서 오류가 나는데 이유를 모르겠습니다.
1422
70 asked
화면에서 아이템을 등록하려고 합니다.
배송방식을 추가하고나서부터 상품 등록 버튼을 누르는 순간400에러가 떨어지는데요ㅠㅠ
20분을 헤멧는데도 이유를 알 수 없어서 질문드립니다.
[컨트롤러]
[DeliveryCode]
[addForm.html]
오류 메시지를 간략하게 적어보면 아래와 같습니다.
2021-07-07 15:10:15.833 WARN 20644 --- [nio-8080-exec-9] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 1 errors
Field error in object 'item' on field 'deliveryCode': rejected value [FAST]; codes [typeMismatch.item.deliveryCode,typeMismatch.deliveryCode,typeMismatch.hello.itemservice.domain.item.DeliveryCode,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [item.deliveryCode,deliveryCode]; arguments []; default message [deliveryCode]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'hello.itemservice.domain.item.DeliveryCode' for property 'deliveryCode'; nested exception is java.lang.IllegalStateException: Cannot convert value of type 'java.lang.String' to required type 'hello.itemservice.domain.item.DeliveryCode' for property 'deliveryCode': no matching editors or conversion strategy found]]
Answer 2
1
혹시 hello.itemservice.domain.item.Item
Item의 필드 중에 deliveryCode를 String 타입이 아닌 다른 타입으로 정의해둔 것이 아닐까 싶습니다.
private ItemType itemType; // 상품 종류
private DeliveryCode deliveryCode; // 배송방식
이렇게 작성해두셨나요..>?
그렇다면 아래처럼 바꿔주시면 될 것 같습니다.
private ItemType itemType; // 상품 종류
private String deliveryCode; // 배송방식
이미지 업로드와 db 트랜잭션 묶는법
0
38
1
Could not resolve org.springframework.boot:spring-boot-starter-validation:2.4.4
0
44
2
MessageSourceTest 코드
0
45
1
인터셉터 에러 설정
0
47
1
resolveArgument()메서드 질문
0
54
1
43강 검증1 에서 실패 로직 관련 질문있습니다.
0
52
2
타임리프 3.X 버전 rendering, serializer 에러 해결 방법
2
130
3
스프링 빈에 등록이 안되는거 같은데 어떻게 하면 좋을까요?ㅠㅠ
0
86
3
pdf 오타 문의
0
54
1
ItemUpdateForm 검증 관련 질문입니다.
0
46
1
22page 링크 주소 변경
0
54
2
특정 데이터와 파일을 함께 저장 시, 테이블 구조 질문
0
52
1
섹션3번 수업에 대한 질문입니다.
0
78
2
@Autowired 보다 더 좋은 방법이 어떤 걸까요?
0
84
2
타입컨버터 가 람다랑 비슷해 보이는데 저의 생각이 맞는지?.
0
63
1
자바스크립트 인라인에서 객체 직렬화 시 오류가 납니다
0
140
3
스프링부트 - 오류페이지2 에서 500.html 에서 쓰인 객체 질문
0
61
1
톰캣 에러 페이지가 안보입니다.
0
98
2
apiEceptionController에서 센드 에러 호출하면 안되는지?
0
80
1
세션 타임아웃시 쿠키 삭제 방법이 없나요?
0
116
2
ApiExceptionController 질문드립니다.
0
62
1
셀렉박스 챕터에서 option value에 ==배송 방식 선택== 이것을 넣은 이유가 궁금함, 이렇게 구상해도 되는지?
0
63
1
MemberRepository 필드의 fianl 선언 유무
0
81
2
혹시 index.html 에서는 fragment 사용이 안되는건가요
0
57
1

