Spring – The Context: ApplicationContext vs. BeanFactory

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.

–          Sample:


–          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.

Happy Reading,

Nirbhaya Bhava!!

About these ads


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

%d bloggers like this: