What is the difference between checked and unchecked exceptions?
Checked exception | Unchecked exception | |
---|---|---|
예외 발생 | 컴파일시 예외 catch부에서 처리 | 런타임 도중 발생하는 catch되지 않은 예외 |
예외 처리 | 예외처리 필수 | 예외처리 필수 아님 |
트랜잭션 처리 | 롤백하지 않음 | 롤백함 |
예시 | IOException, SQLException, ClassNotFoundException, InvocationTargetException | NullPointerException, IndexOutOfBoundsException, IllegalArgumentException, NumberFormatException |
Why does Spring prefer unchecked exceptions?
- Checked exceptions reqires handling, result in cluttered code and unnecessary coupling.
- Unchecked exceptions are non-recoverable exceptions, should not let developer to handle. E.g., when happens, nothing you can do.SQLException
https://mossgreen.github.io/Spring-Certification-Spring-Data-Management/
What is the Spring data access exception hierarchy?
- Data Access Exception is a Runtime Exception
- Examples of concrete Data Access Exceptions
- CannotAcquireLockException
- CannotCreateRecordException
- DataIntegrityViolationException
- Purpose of this hierarchy is to create abstraction layer on top of Data Access APIs to avoid coupling with concrete implementation of Data Access APIs
Spring Professional Exam Tutorial v5.0 - Dominik Cebula
'Certification > Spring(2V0-72.22, SCP)' 카테고리의 다른 글
How do you configure a DataSource in Spring? (0) | 2021.11.07 |
---|---|
What is Spring Boot? (0) | 2021.11.07 |
What is the concept of AOP? Which problem does it solve? What is a cross cutting concern? (0) | 2021.11.06 |
What is dependency injection and what are the advantages of using it? (0) | 2021.11.03 |
Spring MVC - 게시판 페이징 처리 (0) | 2018.10.26 |