| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
Tags
- 1916
- Java
- ConcurrentSessionControlAuthenticationStrategy
- 14891
- Session Registry
- 12100
- Session Fixation Protection
- 1260
- 프로그래머스
- Spring Authorization Server
- 14889
- github actions
- AWS
- aws-mysql-jdbc
- 자바
- tailsamplingprocessor
- Value annotation
- 15686
- SpringCloudConfig
- HttpRequestMethodNotSupportedException
- 백준
- self-hosted runners
- amazon-ecr-login
- 17144
- openTelemetry
- Spring
- RequiredArgsConstructor
- Spring Security
- RestControllerAdvice
- github
Archives
- Today
- Total
한울이
[SPRING] @RestControllerAdvice can not handle HttpRequestMethodNotSupportedException 본문
PROGRAMMING
[SPRING] @RestControllerAdvice can not handle HttpRequestMethodNotSupportedException
gksdnf050 2022. 8. 21. 20:01회사에서 업무를 하다가 HttpRequestMethodNotSupportedException 에 대한 처리를 해야 하는 상황이 생겨서RestControllerAdvice를 사용하여 exception을 handling 하고 있는 곳에 추가해서 처리하려고 했다.
예시

그런데 내가 정의한 ExceptionHandler 에서 exception이 처리되지않고DefaultHandlerExceptionResolver에서 exception이 처리되었다.
알고 보니 basePackageClasses = BaseController.class 부분이 문제였다.

참조
Spring ControllerAdvice - Fail to override handleHttpRequestMethodNotSupported() in ResponseEntityExceptionHandler
Here's a few facts for the situation that I'm currently facing I have recently built a RestControllerAdvice with variousExceptionHandler as a global exception handler for my Spring RestController....
stackoverflow.com
'PROGRAMMING' 카테고리의 다른 글
| [SPRING] k8s cronjob + Spring Batch (0) | 2022.08.21 |
|---|---|
| [SPRING] Lombok @RequiredArgsConstructor @Qualifier (0) | 2022.08.21 |
| [SPRING] Spring Cacheable (0) | 2022.08.21 |
| [SPRING] Spring Cloud Config override (0) | 2022.08.21 |
| [SPRING] Spring Reactive Programming (0) | 2022.08.20 |
Comments