when is a spring bean instantiated

后端 未结 7 1407
借酒劲吻你
借酒劲吻你 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:53

    According to Spring documentation,

    The default behavior for ApplicationContext implementations is to eagerly pre-instantiate all singleton beans at startup.

    Also, you can set them to load lazily.

提交回复
热议问题