您的位置:首页 > 编程语言 > Java开发

Spring回调方法DisposableBean接口

2015-12-02 15:39 477 查看
除了自定义的destroy-method.还可以实现DisposableBean接口,来回调bean销毁时候执行的方法,这个接口有一个destroy方法,生命周期是是destroy----bean销毁---自定义的destroy方法

SimpleBean.java

?
配置文件:

?
测试代码:

?
结果:

this is info from afterpropertiesSet from SimpleBean
before destroy
this is info from destroy method
this is info from customer destroy method
after destory

原文地址:/article/2137177.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: