Tech Rocks

Coldfusion
Java
JQuery

An online resource for latest web technologies like Coldfusion, JRun, Pro*C, JQuery, HTML5, PHP, W3C, Java, J2EE, C, C++, ORACLE, PL/SQL, MySql, Ajax, Coldbox, Fusebox, UNIX, JavaScript, NodeJS and much more...

Tuesday, October 22, 2013

Spring Bean Lifecycle

  • Instantiate - First the spring container finds the bean's definition from the XML file and instantiates the bean..

  • Populate properties - Using the dependency injection, spring populates all of the properties as specified in the bean definition..

  • Set Bean Name - If the bean implements BeanNameAware interface, spring passes the bean's id to setBeanName() method.

  • Set Bean factory - If Bean implements BeanFactoryAware interface, spring passes the beanfactory to setBeanFactory() method.

  • Pre Initialization - Also called postprocess of bean. If there are any bean BeanPostProcessors associated with the bean, Spring calls postProcesserBeforeInitialization() method.

  • Initialize beans - If the bean implements IntializingBean,its afterPropertySet() method is called. If the bean has init method declaration, the specified initialization method is called.

  • Post Initialization - If there are any BeanPostProcessors associated with the bean, their postProcessAfterInitialization() methods will be called.

  • Ready to use - Now the bean is ready to use by the application.

  • Destroy - If the bean implements DisposableBean , it will call the destroy() method .

0 comments :

Post a Comment