728x90
반응형
❓ 에러 발생
Method Not Allowd 라고 에러가 발생헀다.
Intellij 의 run 실행창에서 보면
Resolved [org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'GET' is not supported]
WARN 29148 --- [io-8080-exec-10] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'GET' not supported]
warn 으로 표시된 것을 볼 수 있다.
❗ 해결
근본적인 원인은 Controller가 @RestController 라면 @PostMapping 또는 @GetMapping과
@Controller 라면 @RequestMapping 또는 RequestMethod.POST or GET 사용 시
HTML의 데이터를 보내는 곳, form 또는 ajax의 method와 맞지 않아서 발생한다.
나는
return 타입을 ResponseEntity.ok() 로 변환하여 해결하였다.
반응형