Featured Post

Spring bean life cycle

  1.   Instantiate – First Spring instantiate the bean.
  2.  Populate properties- Spring Inject the bean’s properties.
  3.  Set Bean Name- Spring set bean name. if the bean implements BeanNameAware, spring passes .The  bean’s id to setBeanName() method.
  4. Set Bean factory-If Bean implementsBeanFactoryAware ,spring passes the beanfactory to          setBeanFactory().
  5. Pre Initialization-  It also called postprocess of bean . if there are any bean BeanPostProcessors,  Spring callspostProcesserBeforeInitialization () method.
  6. Initialize beans-   If the bean implementsIntializingBean,itsafterPropertySet() method is called. If the bean has init method declaration, the specified initialization method is  Called.
  7. Post Initialization-  If there is BeanPostProcessors, is implements , spring calls their postProcessAfterinitalization()method.
  8.  Ready to use- Now the bean is ready to use by the application.
  9. Destroy- If the bean implement DisposableBean , it will call the destroy() method . If custom  destroy () method is defined . the specified method is called.

Comments

Popular posts from this blog

[Inside AdSense] Understanding your eCPM (effective cost per thousand impress...