Using Spring 3.0.x, I'm running into an issue where a Bean init-method is running, and as part of it fetches some information, and then in another thread (original init() thread waits on the other threads to complete) tries to get one or more Beans based on that information retrieve. Problem is, these other Beans are singleton as well and haven't been initialized yet. There's a synchronized() block down in DefaultSingletonBeanRegistry in the getSingleton() methods.
The problem arises that I'm trying to get/initialize a Bean while I'm currently initializing a Bean, so I get stuck with the main thread in the init() method, and another thread trying to get another singleton Bean, and is blocked because the 1st thread has the lock.
So, the way I see it, I have 2 options:
1) Get Spring to run a method AFTER the singleton has been fully created that performs the actual data fetch and processing 2) Come up with message passing to which will give the data back to the main thread to then process them all within it since it already has the monitor lock
Thoughts? Ideas? How would I get #1 to work?