How can you override beans default lifecycle methods?
The bean tag has two more important attributes with which you can define your own custom initialization and destroy methods. Here I have shown a small demonstration. Two new methods fooSetup and fooTeardown are to be added to your Foo class.
<beans>
<bean id="bar" class="com.act.Foo" init-method=”fooSetup” destroy=”fooTeardown”/>
</beans>