Pls Subscribe this channel Subscribe ® Registered teknosys.in
Get link
Facebook
X
Pinterest
Email
Other Apps
Spring bean life cycle
Get link
Facebook
X
Pinterest
Email
Other Apps
-
Instantiate – First Spring instantiate the bean.
Populate properties- Spring Inject the bean’s properties.
Set Bean Name- Spring set bean name. if the bean implements BeanNameAware, spring passes .The bean’s id to setBeanName() method.
Set Bean factory-If Bean implementsBeanFactoryAware ,spring passes the beanfactory to setBeanFactory().
Pre Initialization- It also called postprocess of bean . if there are any bean BeanPostProcessors, Spring callspostProcesserBeforeInitialization () method.
Initialize beans- If the bean implementsIntializingBean,itsafterPropertySet() method is called. If the bean has init method declaration, the specified initialization method is Called.
Post Initialization- If there is BeanPostProcessors, is implements , spring calls their postProcessAfterinitalization()method.
Ready to use- Now the bean is ready to use by the application.
Destroy- If the bean implement DisposableBean , it will call the destroy() method . If custom destroy () method is defined . the specified method is called.
Comments