當我在bean中配置了<property name="dao" ref="steerdao"></property>后為什么只調用了初始化方法,并沒有調用destroy()方法?
配置文件如下:
<bean name="chineseSteer" class="com.ly.spring.action.Chinese">
<property name="serivce" ref="steerService"></property>
</bean>
public class Chinese implements InitializingBean,DisposableBean{
public void show() {
serivce.chop();
}
@Override
public void destroy() throws Exception {
System.out.println("destroy()");
}
@Override
public void afterPropertiesSet() throws Exception {
System.out.println("afterPropertiesSet()");
}
2016-10-22
你的Test類或者是他的基類有 在@After調用 context的destroy方法嗎
2016-10-18
不會吧,有銷毀方法