I currently have a Spring service with an @Async method, so when it is called, Spring executes it in a new thread without the request attributes of the parent thread.
I need a way to copy these attributes across to the child thread when calling the async service.
Is there some way to add some kind of interceptor class that Spring will call when creating the new thread, where I could put logic to copy across relevant context values?
Ideally I want to avoid passing the values in a method parameter.
What you need is AsyncHandlerInterceptor and here is a detailed example on how to actualy do that.