Spring_Bean的生命周期






init-method="init" destroy-method="destory"

指定初始化和销毁方法

创建Bean后置处理器

<!-- 实现BeanPostProcessor接口 提供两个方法的实现
postProcessBeforeInitialization init-method之前调用
postProcessAfterInitialization init-method之后调用

bean:bean 实例本身
beanName:Ioc容器配置的bean的名字
返回值,是实际上返回给用户的那个bean,注意可以在以上两个方法中修改返回的bean甚至返回一个新的 bean
-->
<!-- 配置Bean的后置处理器 :不需要配置id,Ioc容器自动识别-->

猜你喜欢

转载自www.cnblogs.com/tanlei-sxs/p/10134095.html