In the "Java" code snippet, the class ExampleBean is missing the implements DisposableBean declaration. Correction: Ensure the class implements the DisposableBean interface.
- Added :
DisposableBeanafter the class name to indicate that the class is implementing theDisposableBeaninterface. - Added the
overridekeyword before the destroy method to indicate that it's being overridden from theDisposableBeaninterface. - Retained the
cleanupfunction 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.