<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>