<bean id="newperson"class="cm.xls.czq.spring.NewPerson" init-method="init"destroy-method="destory">
init-method="init" 初始化的方法
destroy-method="destory"銷燬前的方法
後置處理器是可以配置在初始化前後的方法:
1. 繼承BeanPostProcessor接口
初始化前
public ObjectpostProcessAfterInitialization(Object bean, String beanName) throws BeansException;
初始化後
public Object postProcessBeforeInitialization(Object bean, String beanName)
在bean.xml在新建一個bean
<bean class="cm.xls.czq.spring.MyBeanPostProcessor"></bean>