This article describes the difference between ApplicationContext and BeanFactory in Spring framework.
– BeanFactory is recommended for lightweight framework like — Mobile and Applet.
– BeanFactory is core component of Spring IoC container.
– As ApplicationContext extends BeanFactory so ApplicationContext is more powerful than BeanFactory (like AOP, Internationalization etc.)
– You can configure your beans in the Spring IoC container through XML files, properties files, annotations, or even APIs.
– Container reads these beans by using BeanFactory (or ApplicationContext)
– Let’s say you define the beans in XML file, say applicationcontext.xml.
– Now BeanFactory has to read applicationcontext.xml to load the beans in container.
– For this BeanFactory needs an interface that can provide the xml file o BeanFactory.
– This interface called resource object.
– In case of ApplicationContext, the resource object is implemented internally, so as use We don’t need of resource object.
Hope this will clarify the basic difference.