Making child threads of completion service as Spring aware
posted 7 years ago
I am using the spring 2.5.x and Java 5. My requirement is to run a few processes in parallel using CompletionService (Java 5).
The code is structured as below :
MyCompletionServiceImpl adds 4 different MyCallableImpl . All the above are spring beans. However the tasks that are performed within the callable implementation in turn invoke use some classes (again spring injected) which have DB operations and some ApplContext.getBean calls. However the ApplContext.getBean does not result in the correct bean being found. (Which is available in the original spring context). Can someone please advise on how do we make child threads spring aware. (I cannot reload the spring files in the child threads since performance will take a major hit).