NOTE
Ordering Spring Bean Initialization
How to express real bean dependencies instead of relying on incidental initialization order.
This is a historical learning note and may contain outdated or incomplete understanding.
If bean B truly requires bean A to exist first, model that dependency explicitly through constructor/setter injection or @DependsOn when there is an initialization dependency without a normal object reference.
Do not rely on component-scan order, source-file order, or bean-name ordering; those are not a robust application dependency model.
For startup tasks that need the whole context ready, use an appropriate lifecycle/application-runner/event hook rather than manufacturing artificial bean dependencies.