Spring interview questions
- What is IOC
- Inversion of Control means that we have inverted the control of creating the object from our own using new operator to container or framework. It's the responsibility of container to create object as required. We maintain one xml file where we configure our components, services and all classes and their property. We just need to mention which service is needed by which component and container will create the object for us. This concept is known as dependency injection
- Explain Bean LifeCycle
- Container will look the bean definition inside the configuration file (bean.xml)
- Using reflection container will create the object and if any property is defined inside the bean definition then it will be also set
- If the bean implements the BeanNameAware interface the factory calls setBeanName() passing the bean's ID
- If the bean implements the BeanFactoryAware interface the factory calls setBeanFactory() passing an instance of itself
- If there are any BeanPostProcessors associated with the bean their post- ProcessBeforeInitialization() methods will be called before the properties for the Bean are set.
- If an init() method is specified for the bean, it will be called
- If the Bean class implements the DisposableBean interface, then the method destroy() will be called when the Application no longer needs the bean reference.
- If the Bean definition in the Configuration file contains a 'destroy-method' attribute, then the corresponding method definition in the Bean class will be called.
- What is BeanFactory
- Difference between BeanFactory and ApplicationContext
- What are the different modules in Spring
- Difference between Singleton and Prototype bean
- What type of Transaction Management Spring support.
- What is AOP
- Explain advice
- What is joing point and pointcut
- How to configure Hibernate with Spring
- Transaction propagation types in Spring
Brak komentarzy:
Prześlij komentarz