티스토리 뷰
@InitBinder
- Spring Validator 사용 시 @Valid 애노테이션으로 검증이 필요한 객체를 가져오기 전에 수행할 메소드를 지정해주는 애노테이션.
- Binding ?
파라미터의 수집
@InitBinder
public void initBinder(WebDataBinder webDataBinder){
// 무시할 필드명 명시
webDataBinder.setDisallowedFields("id");
// 허용할 필드명 명시
webDataBinder.setAllowedFields("id");
// 특정 Formatter 등록
webDataBinder.addCustomFormatter();
// 특정 CustomEditor 등록
webDataBinder.registerCustomEditor(Date.class, new CustomDateEditor(new ISO8601DateFormat(), false));
// 특정 Validator 등록
webDataBinder.addValidators(new EventValidator());
}
// passwordForm 객체에만 PasswordFormValidator 가 적용
@InitBinder("passwordForm")
public void passwordFormInitBinder(WebDataBinder webDataBinder) {
webDataBinder.addValidators(new PasswordFormValidator());
}
반응형
'Java' 카테고리의 다른 글
ModelMapper (0) | 2021.03.04 |
---|---|
@AuthenticationPrincipal (0) | 2021.03.01 |
java validation (0) | 2021.02.26 |
13. I/O (0) | 2021.02.24 |
12. 애노테이션 (0) | 2021.02.06 |
링크
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- JS 딥다이브
- js api
- 드림코딩
- java
- js promise
- 프로그래머스
- 김영한 http
- dreamcoding
- JPA 연관관계 매핑
- js array
- 백기선 스터디
- 모던자바스크립트
- http
- 이펙티브자바 스터디
- REST API
- 이펙티브자바 아이템60
- 패스트캠퍼스 컴퓨터공학 완주반
- 킹수빈닷컴
- 김영한 JPA
- 집 구하기
- 백준
- BOJ
- 이펙티브자바
- HTTP 완벽 가이드
- HTTP 완벽가이드
- 프로그래머스 SQL
- GCP
- Spring Security
- 가상 면접 사례로 배우는 대규모 시스템 설계 기초
- 이펙티브자바 아이템59
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함