Provides a brief description of when spring instantiates a bean, starting with 2 scenarios
First: If you use Beanfactory as the factory class for the spring bean, all the beans are instantiated the first time the bean is used
Second: If you use ApplicationContext as the factory class for spring beans, you are divided into the following scenarios:
(1): If the bean's scope is singleton , and Lazy-init is False(the default is False, so you can not set), then The bean is instantiated when the ApplicationContext is started, and the instantiated bean is placed in a cache of the map structure, which is taken directly from the cache the next time the bean is used.
(2): If the bean's scope is singleton and Lazy-init is true, then instantiation of the bean is instantiated the first time the bean is used
(3): If the bean's scope is prototype , instantiation of the bean is instantiated the first time the bean is used
When does spring instantiate a bean