spring随手笔记3:销毁方法

1.

 public class HelloWorld {
private String msg;
public void setMsg(String msg) {
this.msg = msg;
}
public String getMsg() {
return msg;
}
public void detory(){
this.msg="";
}
}
<bean id="HelloWord" class="com.ltf.captha.serviceImpl.HelloWorld" destroy-method="destory">
<property name="msg">
<value>helloworld</value>
</property>
</bean>

2.  实现org.springframework.beans.factory.DisposableBean中的destory方法

public class HelloWorld implements DisposableBean{
private String msg;
public void setMsg(String msg) {
this.msg = msg;
}
public String getMsg() {
return msg;
}
public void destroy() throws Exception {
this.msg="";
} }
上一篇:Myeclipse 2016 & 2014 下载


下一篇:【牛客网-剑指offer】跳台阶