In the "Java" code snippet, the class ExampleBean
is missing the implements DisposableBean
declaration. Correction: Ensure the class implements the DisposableBean
interface.
- Added :
DisposableBean
after the class name to indicate that the class is implementing theDisposableBean
interface. - Added the
override
keyword before the destroy method to indicate that it's being overridden from theDisposableBean
interface. - Retained the
cleanup
function as-is, in case you have additional cleanup tasks you want to perform that are specific to this class.
Comment From: sbrannen
As stated in the documentation, the ExampleBean
class intentionally does not implement DisposableBean
since its cleanup
method is configured as the destroy-method
in the corresponding XML configuration.
Whereas, the AnotherExampleBean
class in the subsequent example does implement DisposableBean
.
In light of that, I am closing this PR.