- RequestContextHolder 다른 스레드에서 사용
https://gompangs.tistory.com/entry/Spring-RequestContextHolder

 

Spring RequestContextHolder

RequestContextHolder 개요 RequestContextHolder 는 Spring에서 전역으로 Request에 대한 정보를 가져오고자 할 때 사용하는 유틸성 클래스이다. 주로, Controller가 아닌 Business Layer 등에서 Request 객체를 참고하려

gompangs.tistory.com

 

- async 처리시 로깅을 위해 ThreadLocal, MDC, 그리고 TaskDecorator 를 활용해보자
https://blog.gangnamunni.com/post/mdc-context-task-decorator/

 

Spring 의 동기, 비동기, 배치 처리시 항상 context 를 유지하고 로깅하기

async 처리시 로깅을 위해 ThreadLocal, MDC, 그리고 TaskDecorator 를 활용해보자 by 강남언니 블로그

blog.gangnamunni.com


- RequestContextHolder 다른 스레드에서 사용 - TaskDecorator 이용
https://stackoverflow.com/questions/23732089/how-to-enable-request-scope-in-async-task-executor#The%20easiest%20way%20is%20to%20use%20a%20task%20decorator%20like%20this:

 

How to enable request scope in async task executor

In my app I have some async web services. Server accept request, return OK response and start processing request with AsyncTaskExecutor. My question is how to enable request scope here because in t...

stackoverflow.com




- spring-boot 3.x.x ThreadLocal 문제

https://github.com/spring-projects/spring-boot/issues/36763

 

Spring Boot versions 3.x.x problems with context Inheriterance in async methods · Issue #36763 · spring-projects/spring-boot

The same code is working using version 2.x.x. The combination of @async methods and ContextHolders inside these async methods returns the following error in version 3.x.x of spring boot. Code: Anot...

github.com

 

Posted by 張's blog
,