In SpringFramework 1.1.1 's reference, There was a small mistake in 3.4.1.2 I think.
The destroy-method attribute's value "destroy" may be the same with ExampleBean's method ,but there is a "cleanup()" method there.
:wink:
==============================================
3.4.1.2. DisposableBean / destroy-method
...
Note: generally, the use of the DisposableBean marker interface can be avoided (and is discouraged since it unecessarily couples the code to Spring). A bean definition provides support for a generic destroy method to be specified. In the case of the XmlBeanFactory, this is done via the destroy-method attribute. For example, the following definition:
<bean id="exampleInitBean" class="examples.ExampleBean" destroy-method="destroy"/>
public class ExampleBean {
public void cleanup() {
// do some destruction work (like closing connection)
}
}
Is exactly the same as:
<bean id="exampleInitBean" class="examples.AnotherExampleBean"/>
public class AnotherExampleBean implements DisposableBean {
public void destroy() {
// do some destruction work
}
}
==============================================


Reply With Quote