when is a spring bean instantiated

后端 未结 7 1410
借酒劲吻你
借酒劲吻你 2020-12-08 07:26
ApplicationContext ctx = new ClassPathXmlApplicationContext(
    \"com/springinaction/springidol/spring-idol.xml\");
Performer performer = (Performer) ctx.getBean(\"         


        
7条回答
  •  执念已碎
    2020-12-08 07:44

    By default, Spring ApplicationContext eagerly creates and initializes all ‘singleton scoped‘ beans during application startup itself. ApplicationContext makes the bean available in BeanFactory. getBean() returns the instance of the bean.

提交回复
热议问题