Sign up ×  While learning Spring framework, I found that Spring
framework provides init-method and destroy-methods which can be
used to initialize some properties or to do housekeeping stuff.
We can do all those things in the bean's constructor so why do
Spring provides these things and in the real world what is the
actual use of these two things?  share|improve this question  3
Answers 3  up vote 4 down vote accepted  When you use setter-
based dependency injection, the init-method makes it possible to
perform initialization: the specified method will be called
after all the setters have been called.  As per destroy-method,
it seems that implementing finalize in Java classes is not a
good practice, instead, and many libraries define a close method
which may or may not be called from finalize. See this
discussion:  EDIT (to clarify things even further)  In setter-
based injection methods will be called in the following order:
1. default constructor   2. the setters corresponding to each
<property> of the be