Spring如何实现初始化完Bean调用指定函数

第一种:

 实现InitializingBean接口,重写afterPropertiesSet()方法。

第二种:

属性配置文件init-method指定。

同理还有销毁方式,所不同的是:

第一种:

需要实现DisposableBean中的destroy()方法。

第二种

destroy-method指定。

猜你喜欢

转载自newday.iteye.com/blog/1844048