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="";
}
}
spring随手笔记3:销毁方法的更多相关文章
- spring随手笔记2:初始化方法
1.init-method="init" public class HelloWorldServiceImpl implements HelloWorldService { pri ...
- spring随手笔记4:ref的属性
1.local属性 引用在同一个xml的bean 只能引用bean的id <bean id="HelloWord" class="com.ltf ...
- spring随手笔记1:constructor-arg
<bean id="Hello" class="com.ltf.captha.serviceImpl.HelloWorldServiceImpl"> ...
- Spring 为Bean对象执行初始化和销毁方法
1)初始化: ①可以利用<bean>元素的init-method="方法名"属性指定初始化方法. ②指定的初始化方法是在构造方法调用后自动执行.若非单例模式,则每创建一 ...
- Spring学习笔记--初始化和销毁Bean
可以使用bean的init-method和destroy-method属性来初始化和销毁bean.定义一个Hero类: package com.moonlit.myspring; public cla ...
- spring bean初始化及销毁你必须要掌握的回调方法
spring bean在初始化和销毁的时候我们可以触发一些自定义的回调操作. 初始化的时候实现的方法 1.通过java提供的@PostConstruct注解: 2.通过实现spring提供的Initi ...
- 七、spring生命周期之初始化和销毁方法
一.通过@Bean指定初始化和销毁方法 在以往的xml中,我们是这样配置的 <bean id="exampleInitBean" class="examples.E ...
- 【Spring Framework】Spring注解设置Bean的初始化、销毁方法的方式
bean的生命周期:创建---初始化---销毁. Spring中声明的Bean的初始化和销毁方法有3种方式: @Bean的注解的initMethod.DestroyMethod属性 bean实现Ini ...
- Spring的几种初始化和销毁方法
一 指定初始化和销毁方法 通过@Bean指定init-method和destroy-method: @Bean(initMethod="init",destroyMethod=&q ...
随机推荐
- 移动端开发tips
为什么使用touch click有300sm的延迟 touch支持多点触摸 手势操作
- .NET学习记录2
前面回忆了一些C#基础语法,简单整理了一下笔记,要想深入研究的话,那就得找一本比较好的书了.接下来继续回忆C#语法知识. 方法 功能:用来复用代码的.当我们在一个程序 中反复的写了同样的代码,那么一般 ...
- sklearn 组合分类器
组合分类器: 组合分类器有4种方法: (1)通过处理训练数据集.如baging boosting (2)通过处理输入特征.如 Random forest (3)通过处理类标号.error_corre ...
- 微信端应用 ionic实现texarea 自适应高度
最近公司项目,做微信端用到texarea 需要实现自适应高度的功能 当然自适应高度的方法很多网上找一大片,最直接的方式就是在使用到texarea的controller中添加js代码事件来实现,这中方式 ...
- 助手系列之python的FTP服务器
电脑的OS是Win7,Python版本是2.7.9,安装了pip 因为python没有内置可用的FTP SERVER,所以先选一个第三方的组件安装上,这里我选的是pyftpdlib pip insta ...
- 一面cvte
昨天上午去cvte参加一面,和好基友一块,离学校很近,10点多一点到了,一出电梯,傻眼了(不是美女很多),是人真的很多,等了2个小时才轮到我们,一个hr面3个人,我和基友,还有一个本科小盆友,问了5个 ...
- 较全的IT方面帮助文档
http://www.shouce.ren/post/d/id/108632 XSLT参考手册-新.CHMhttp://www.shouce.ren/post/d/id/108633 XSL-FO参考 ...
- httpclient调用https
httpclient调用https报错: Exception in thread "main" java.lang.Exception: sun.security.validato ...
- 利用ksoap调用webservice
博文参考: http://www.cnblogs.com/shenliang123/archive/2012/07/05/2578586.html http://blog.csdn.net/jimbo ...
- OGNL_一点
ognl此表达式语言,是一门什么样的语言呢?下面然我为大家简单的讲解一点小小的关于它的内容吧! 然我来简单得解释说:OGNL(Object-Graph Navigation Language),可以方 ...