BeanFactory vs ApplicationContext
Read more »
The difference between BeanFactory and ApplicationContext in Spring framework is another frequently asked Spring interview question mostly asked Java programmers with 2 to 4 years experience in Java and Spring. Both BeanFactory and ApplicationContext provides a way to get a bean from Spring IOC container by calling getBean("bean name"), but there is some difference in there working and features provided by them. One difference between bean factory and application context is that former only instantiate bean when you call getBean() method while ApplicationContext instantiates Singleton bean when the container is started, It doesn't wait for getBean to be called. This interview questions is third on my list of frequently asked spring questions e.g. Setter vs Constructor Injection and What is default scope of Spring bean. If you are preparing for Java interview and expecting some Spring framework question, It’s worth preparing those questions.