Dispose the bean with destroy()

If the bean class implements the DisposableBean interface, its destroy() method will get called to release memory. It has the same drawback as that of InitializingBean. To overcome it, we have the custom destroy method.

Let's take the example of a JDBC connection. The connection opened for use needs to be closed down once the task is completed. The connection can be opened in the initialization method, and will be closed in the destroy() method.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.227.69