如果在这样注入:
<bean id="accountDAO" class="com.brj.test.AccountDAO" init-method="init" destroy-method="close">
<property name="ds" ref="dataSource"></property>
</bean>
则需要在AccountDAO中添加两个方法:
public void init() {
System.out.println("init method.");
}
public void close(){
System.out.println("destroy method.");
}
读完这篇文章后,您心情如何?