티스토리 뷰
@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
- GCP
- ㅇㄷㅇㅈ
- JPA 연관관계 매핑
- Spring Security
- 김영한 JPA
- js array
- 모던자바스크립트
- 이펙티브자바 아이템60
- JS 딥다이브
- 패스트캠퍼스 컴퓨터공학 완주반
- HTTP 완벽 가이드
- dreamcoding
- REST API
- 백기선 스터디
- 이펙티브자바 스터디
- 이펙티브자바 아이템59
- BOJ
- 킹수빈닷컴
- http
- 가상 면접 사례로 배우는 대규모 시스템 설계 기초
- 프로그래머스 SQL
- 김영한 http
- 드림코딩
- js api
- 프로그래머스
- HTTP 완벽가이드
- 백준
- 이펙티브자바
- js promise
- java
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함