When does spring create instances to be injected ?
When does spring create instances to be injected ?
This is one of the famous spring / spring boot framework interview question.
- Spring creates the instances to be injected during the start up.
- If you have configured spring beans with lazy-init attribute then spring creates the instances of those bean only when you inject/any of it’s dependencies injects it.
- By default, Application Context creates the instances of all the beans eagerly with singleton scope during it’s initialization process only.