spring初始化bean之后的3种回调方式

1、类中某方法加注解@PostConstruct

2、实现InitializingBean接口,实现afterPropertiesSet方法

3、xml方式,bean标签里配置init-mothod属性,指向类中的方法。

 

 

 

 他们的执行顺序是

1-@PostConstruct

2-实现InitializingBean中的afterPropertiesSet

3-xml方式

 

 

 

 

posted @ 2019-11-16 17:53  土豆Z120553  阅读(1578)  评论(0编辑  收藏  举报