Skip to main content

Custom and Business Exceptions

Learn Custom and Business Exceptions (Exception Handling, Spring Boot) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

Checked or Unchecked? The Decision Spring Made for You Java has two kinds of exceptions. The difference is whether the compiler forces every caller to deal with them. Modern Spring code uses unchecked exceptions for business and application errors. Checked exceptions force every method between the failure and the handler to declare or wrap the error, and then the one place that finally handles it (your @RestControllerAdvice ) is far from the place that knew what went wrong. Spring itself converts checked SQLException into unchecked DataAccessException for exactly this reason.

More lessons in Exception Handling