Sunday, October 28, 2012

what are method hooks / callback methods in bean creation?

Spring Framework provides a couple of hooks in the form of callback methods.these methods provide opportunity for the bean to initialize properties or clean up resources

there are two method hooks :

init-method

destroy-method


<bean name="oracleDAO" class="com.suresh.OracleDAO" init-method="initializePool"/>

The similar functionality can  be  achieved using special interfaces

> InitializeingBean     -> method: afterPropertiesSet

> DisposableBean    -> method: destory


No comments:

Post a Comment