일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |
- QueryDSL
- 스프링 핵심 기능
- JPQL
- JDBC
- Android
- Servlet
- http
- pointcut
- 인프런
- 김영한
- Exception
- 스프링
- 백준
- Greedy
- transaction
- kotlin
- 그리디
- Thymeleaf
- 알고리즘
- 스프링 핵심 원리
- db
- spring
- AOP
- Spring Boot
- Proxy
- jpa
- SpringBoot
- java
- 자바
- springdatajpa
- Today
- Total
목록HandlerExceptionResolver (2)
개발자되기 프로젝트
1.예외를 ExceptionResolver에서 마무리하기 예외가 발생하면 WAS까지 예외가 던져지고, WAS에서 오류 페이지 정보를 찾아서 다시 /error 를 호출하는 과정은 생각해보면 너무 복잡하다. ExceptionResolver 를 활용하면 예외가 발생했을 때 이런 복잡한 과정 없이 ExceptionResolver에서 문제를 깔끔하게 해결- > BasicErrorController호출하는 등의 절차가 없음. 2. UserException 임의의 예외를 만듦 public class UserException extends RuntimeException{ public UserException() { super(); } public UserException(String message) { super(me..
예외가 발생해서 서블릿을 넘어 WAS까지 예외가 전달되면 HTTP 상태코드가 500으로 처리된다. 발생하는 예외에 따라서 400, 404 등등 다른 상태코드로 처리하고 싶은데? 오류 메시지, 형식등을 API마다 다르게 처리하고 싶다.?? 예를들어 IllegalArgumentException이 controller 밖으로 넘어가면???400으로 처리하고 싶음! 400 : Client가 범인임! 1. ApiExceptionController "/api/members/bad"로 넘어오면 IllegalArgumentException을 던지자. @GetMapping("/api/members/{id}") public MemberDto getMember(@PathVariable("id") String id){ if(i..