try/catch문과 & globalExceptionHandler에 대하여
spring으로 프로젝트 진행하며 spring 공부도 중요하지만 java에 대한 이해도가 중요하다고 느껴서 w3c school에서 java tutorial을 보던 중 궁금증이 생겼다.
1. try catch문은 성능에 어떤 영향을 미칠까? 답 : 성능상 try catch문 유무는 유의미한 영향을 미치지 않는다.
2. 언제 try/catch문과 spring의 Global Exception handling 사용? 답 : 예측 가능한 exception 들에 대한 명시적 처리를 할 때 try/catch 사용, system error 또는 unhandled exception에 대해서는 GE를 활용
질문 1 ref
Is it expensive to use try-catch blocks even if an exception is never thrown?
We know that it is expensive to catch exceptions. But, is it also expensive to use a try-catch block in Java even if an exception is never thrown? I found the Stack Overflow question/answer Why a...
stackoverflow.com
질문 2 ref
When is it proper to try/catch versus global exception handling?
Earlier today Seth (@CapedCoder) mentioned something on Twitter that I thought was a bit odd. He was looking for a way to disable try/catch functionality for dev versus production. Basically, "Don't try/catch in dev." This led to a few emails back and fort
www.raymondcamden.com
https://stackoverflow.com/questions/58361013/global-exception-handling-vs-try-catch-everywhere
Global exception handling VS Try catch everywhere
Recently I have used Global exception handling in my code and I came to know that with this all exceptions can be handled. Previously I was using try-catch at each controller and now I have removed...
stackoverflow.com