I want to pass objects between methods within a thread without using a method signature.
Example:
public class Controller {
@GET
public void requestController() {
// set user data in the controller currentThread
}
}
public class Service {
public void serviceMethod() {
// get user data in the service method from currentThread
}
}
as Controller
and Service
are in the same thread, I should be able to access the object in Service
that was set in the Controller
.
MDC
does follow the same approach using MDC.put
and MDC.get
but I am not sure which pattern it uses.