Refresh Your Java - Before Java Interview
We are Agile, believe in less Documentation - Only Quick notes (Java Interview Questions) of Java/J2ee Read more....
Spring's bean has a very elaborated life cycle which gives opportunities to hook up some custom code or logic in various life cycle stages. There are two distinct spring containers one is bean factory and another is application context. More precisely, only one additional phase is added in case of application context.
1. Instantiate: in this
phase container finds the bean's definition and
instantiates it.
2. Populate
properties: in this phase using the
dependency injection all the properties are populated which are
specified in the bean definiton (in the xml file).
3. Set Bean Name
: If BeanNameAware
interface is implemented the factory calls the setBeanName()
passing the Bean's Id.
4. Set Bean
factory: if
BeanFactoryAware interface is implemented setBeanFactory() method
is called.
5. ApplicationContextAware: This
step is valid only if the Application context container is used.
In this phase if bean implements the ApplicationcontextAware then
setApplicationContext() method is called.
6. Pre-initialization: If
any BeanPostProcessors are associated with the bean then their
postProcessBeforeInitialization() methods will be called.
7. InitializingBean: If
an init-methodis specified for the bean then it is called.
8. Post
Initialization: If
there are any BeanPostProcessors are associated then
postProcessAfterInitialization() is called.
9. Destroy: If bean implements the DisposableBean interface then destroy() method is called.
This Portal is intended to put all Java/J2ee related topics at one single place for quick referance, not only Technical , but also the Project Management Related thing such as Development Process methodoogies build process, unit testing etc.,
This Portal has More than 500 Java Interview Questions (also could be Considered as Quick Notes) very neatly separated topic by topic with simple diagrams which makes you easily understandable. Importantly these are from our Realtime expericance.