-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Description
Liu, Yinwei David opened SPR-7266 and commented
If we have two beans Bar and Foo. Both beans implement SmartLifecycle, and they reference to each other. Spring will not be able to get started because it repetitively calls itself in DefaultLifecycleProcessor to start itself.
public class FooImpl implements Foo, SmartLifecycle{
Bar _bar;
public int getPhase(){ return 1; }
...
}
public class BarImpl implements Bar, SmartLifecycle
{
Foo _foo;
public int getPhase() { return 2; }
...
}
What I expected is that the bean FooImpl start first, and then Bar gets started.
However, Spring is not able to resolve it so that we get exception StactkOverflow. I tried to override DefaultLifecycleProcessor to make it not start bean twice, then spring can successfully get started.
Can we fix this bug in DefaultLifecycleProcessor to be able to resolve the circular reference? thanks
Affects: 3.0.2
Attachments:
- packages.zip (5.53 kB)
Referenced from: commits 65622bd