Post

2023-02-14-TIL

2023-02-14-TIL

Today I Learned

Custom Exception vs Runtime Exception

  • https://tecoble.techcourse.co.kr/post/2020-08-17-custom-exception/

Checked Exception vs Unchecked Exception

  • https://bcp0109.tistory.com/303

Error Handling for REST with Spring

  • https://www.baeldung.com/exception-handling-for-rest-with-spring
  • https://www.baeldung.com/spring-response-status-exception
  • https://naiyer.dev/post/2020/07/26/error-handling-for-a-spring-based-rest-api/
  • https://cheese10yun.github.io/spring-guide-exception/
  • https://mangkyu.tistory.com/204
  • https://wookim789.tistory.com/62
  • https://luvstudy.tistory.com/50
  • https://www.digitalocean.com/community/tutorials/spring-mvc-exception-handling-controlleradvice-exceptionhandler-handlerexceptionresolver

Response Entity vs Custom Response

  • https://www.baeldung.com/spring-response-entity
  • https://medium.com/codestorm/custom-json-response-with-responseentity-in-spring-boot-b09e87ab1f0a
  • https://velog.io/@_koiil/Custom-Response%EC%9D%98-%ED%95%84%EC%9A%94%EC%84%B1
  • https://tecoble.techcourse.co.kr/post/2021-05-10-response-entity/
  • https://stackoverflow.com/questions/26549379/when-use-responseentityt-and-restcontroller-for-spring-restful-applications
  • https://zetcode.com/springboot/responseentity/
  • https://www.springcloud.io/post/2022-02/responseentity-tips/#gsc.tab=0
  • https://www.javaguides.net/2019/08/spring-responseentity-using-responseentity-in-spring-application.html
  • https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/http/ResponseEntity.html
  • https://a1010100z.tistory.com/106
  • https://devlog-wjdrbs96.tistory.com/182

Logging Thread ID

여러 개의 서버 인스턴스로 나누어져 있을 때, 통합해서 로그를 보려면 Thread ID가 유용하다. MSA 구조에서는 Span ID, Transaction ID로 엮어서 일련의 연쇄적인 요청 수행의 과정을 볼 수 있지만, MSA 구조가 아니라면 Thread ID로도 충분하다.

RestTemplate vs …

RestTemplate은 스프링에서 기본적으로 지원해주는 HTTP 요청 템플릿이다. 하지만 팀원 중 한 명은 이것이 그렇게 좋지 않다는 의견이다. 오히려 Fiegn Client, Retrofit 같은 것들이 더 깔끔하다고 말한다. 너무 당연하게도 아무 생각없이 RestTemplate을 사용해왔는데, 새로운 시각을 얻게 되었다.

  • https://www.baeldung.com/spring-webclient-resttemplate
  • https://digitalbourgeois.tistory.com/56
  • https://www.baeldung.com/spring-boot-feignclient-vs-webclient
  • https://medium.com/@MonkeyPatch/feign-vs-retrofit-1-getting-started-1298b57a254
  • https://www.javacodemonk.com/retrofit-vs-feign-for-server-side-d7f199c4
  • https://sylvainleroy.com/2018/04/13/rest-http-client-feign-vs-retrofit-2/
This post is licensed under CC BY 4.0 by the author.