Spring —— bean生命周期

bean生命周期

  • 生命周期:从创建到消亡的完整过程
  • bean生命周期:bean从创建到销毁的整体过程
  • bean生命周期控制:在bean创建后到销毁前做一些事情

 

  方式一:配置控制生命周期

    <bean id="bookDao" class="com.cqupt.dao.impl.BookDaoImpl" init-method="init" destroy-method="destroy"/>

  

  方式二:接口控制生命周期(了解)

  

  

    

posted @ 2022-10-23 16:41  风陵南  阅读(30)  评论(0)    收藏  举报