| Share this post! | Vote this! |
|
When creating an instance of a bean you might need to do some
initialization to the bean. Likewise, when the bean is no longer needed
and removed from the Spring container you might want to do some cleanup
routine or destroy the bean.
To do this initialization and destroy routine you can use the
By defining the
To do this initialization and destroy routine you can use the
init-method and destroy-method attribute when declaring a bean in spring configuration using the <bean> element.By defining the
init-method and destroy-method
it will allow the Spring Container to call the initialization method
right after the bean created. And just before the bean removed and
discarded from the container, the defined destroy method will be called.
Let's see some code snippet as an example. more...



0 comments:
Post a Comment