0

I am trying to understand the concept of lifecycle and callback in Spring framework. I did search in SO, for example this question.

I am still not clear on this, are these terms viz: life-cycle and callback one and same thing or are they two different concepts?

Can anyone help me clarify this?

CuriousMind
  • 8,301
  • 22
  • 65
  • 134
  • 1
    lifecycle: what happens during the life of something, from the moment it's created until it's destroyed. Callback: a method that you create and that is called by the framework. Lifecycle callback: a method that you create and that is called by the framework at specific moments of the life of a bean. – JB Nizet Jan 21 '18 at 20:52
  • @JBNizet: Thanks for your reply. So, as I understand these are generic concepts, not necessarily tied up to Spring Framework. And during various "phases" of object , methods which are (automatically) called by framework are referred to as "callbacks". Now, if I understood this corrects, it reminds me of some EJB 2.x methods like: ejbActivate(), ejbPassivate().. Did I understood correct? – CuriousMind Jan 21 '18 at 21:06
  • 1
    You got it right. They're indeed the same kind of things as ejbActivate. – JB Nizet Jan 21 '18 at 21:10
  • @JBNizet: Thanks again, for your help; I wish you had written as answer and I would have accepted by now. Thanks a ton! – CuriousMind Jan 21 '18 at 21:11

0 Answers0