public class Others implements BeanPostProcessor{  public Others(){    //第一步 调用无参数的构造方法创立bean实例  }    private String othername;  public void setOtherName(String otherName){    //第二步 调用set办法设置属性  }    public Object postProcessorBeforeInitialization(){   //第3.1步 初始化之前执行的办法 前置处理器 **留神会对bean.xml中所有bean都增加该处理器**  }    public void initMethod(){    //第三步 执行初始化办法  }    public Object postProcessorAfterInitialization(){   //第3.2步 初始化之后执行的办法 后置处理器  }    public void destoryMethod(){    //第五步 执行销毁办法  }}
public void test(){  ApplicationContext context = new ClassPathXmlApplicationContext("bean.xml");  Others others = context.getBean("others",Others.class);  //第四步 获取创立Bean实例对象  ((ClassPathXmlApplicationContext) context).close;}
<bean id="others" class="com.zong.spring.Others" init-method="initMethod" destory-method="destoryMethod">