BindingResult와 Errors의 차이점 에 대해
에러처리를 할 때에 파라미터로 BindingResult와 Errors를 사용할 때가 있다. 이 둘의 차이점은 무엇일까?
BindingResult는 인터페이스고, Errors 인터페이스를 상속받고 있다.
실제 넘어오는 구현체는 BeanPropertyBindingResult 인데 BindingResult대신 Errors를 사용해도 된다.
Errors 인터페이스는 단순한 오류 저장과 조회 기능을 제공한다.BindingResult는 여기에 더해서 추가적인 기능들을 제공한다. (ex. addError())
REFERENCE
https://www.inflearn.com/course/%EC%8A%A4%ED%94%84%EB%A7%81-mvc-2/dashboard
너무 짧은 내용이라 기타 등등에 추가하려다가 스프링이라 따로 뺐다...
'Spring' 카테고리의 다른 글
| [Spring] Enum에 빈을 주입하는 방법에 대해 (0) | 2021.07.10 |
|---|---|
| [Spring] @ConfigurationProperties를 이용한 yml 설정 파일들의 객체 추상화 (0) | 2021.07.08 |
| [Spring] HttpMessageConverter가 적용되는 시점에 대해 (3) | 2021.06.14 |
| [Spring] Gradle 파일 implementation, api, runtimeOnly, compileOnly... 등에 대해 (3) | 2021.06.06 |
| [Spring] @Profile, @ActiveProfiles 에 대해 (0) | 2021.05.23 |