{"id":7125,"date":"2021-04-26T15:05:44","date_gmt":"2021-04-26T19:05:44","guid":{"rendered":"https:\/\/springframework.guru\/?p=7125"},"modified":"2021-09-06T10:36:06","modified_gmt":"2021-09-06T14:36:06","slug":"spring-beanfactory-vs-applicationcontext","status":"publish","type":"post","link":"https:\/\/springframework.guru\/spring-beanfactory-vs-applicationcontext\/","title":{"rendered":"Spring BeanFactory vs ApplicationContext"},"content":{"rendered":"<p>The <a href=\"https:\/\/docs.spring.io\/spring-framework\/docs\/3.2.x\/spring-framework-reference\/html\/beans.html\" target=\"_blank\" rel=\"noopener\">Spring Ioc container<\/a> is at the core of the Spring Framework. <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">BeanFactory<\/code> and <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">ApplicationContext<\/code> provide implementations of the IoC container. Both <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">BeanFactory<\/code> and <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">ApplicationContext<\/code> are interfaces and there are several implementations that come out of the box with Spring.<\/p>\n<p>In this post, I will explain the differences between <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">BeanFactory<\/code> and <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">ApplicationContext.<\/code><\/p>\n<h2>Major Differences between <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">BeanFactory<\/code> and <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">ApplicationContext<\/code><\/h2>\n<p>Following are few differences :<\/p>\n<ul>\n<li><code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">BeanFactory<\/code> instantiates a bean when you call the <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">getBean()<\/code> method while <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">ApplicationContext<\/code> instantiates<br \/>\na Singleton bean as soon as the container starts.<\/li>\n<li><code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">BeanFactory<\/code> supports lazy loading unlike <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">ApplicationContext<\/code> that support default eager loading.<\/li>\n<li><code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">BeanFactory<\/code> doesn&#8217;t provide support for internationalization but <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">ApplicationContext<\/code> provides support for it.<\/li>\n<li><code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">XMLBeanFactory<\/code> implements <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">BeanFactory<\/code> whereas <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">FileSystemXmlApplicationContext<\/code>, <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">ClassPathXmlApplicationContext<\/code> and <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">AnnotationConfigWebApplicationContex<\/code> implements <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">ApplicationContext<\/code>.<\/li>\n<\/ul>\n<p>Here is an example of how to get a bean through both ways.<\/p>\n<h2>Maven Dependency to define Spring Injection Container<\/h2>\n<p>To work with beans and bean instantiation, you will require <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">spring-context<\/code> dependency to add in your <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">pom.xml<\/code> file.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"xml\">  \r\n&lt;dependency&gt;\r\n   &lt;groupId&gt;org.springframework&lt;\/groupId&gt;\r\n   &lt;artifactId&gt;spring-context&lt;\/artifactId&gt;\r\n   &lt;version&gt;5.3.5&lt;\/version&gt;\r\n&lt;\/dependency&gt;\r\n<\/pre>\n<p>In the example domain, I have taken two POJO classes &#8211; <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">Book<\/code> and <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">BookPublisher.<\/code><\/p>\n<p>The code for <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">BookPublisher<\/code> class is this.<\/p>\n<p><strong>BookPublisher.java<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\">@Component\r\npublic class BookPublisher {\r\n\r\n    private int publisherId;\r\n    private String firstName;\r\n    private String lastName;\r\n\/\/No-args Constructor\r\n\/\/Parametrized-Constructor\r\n\/\/Getters and Setters\r\n\/\/to-String method\r\n}\r\n<\/pre>\n<p>The <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">BookPublisher<\/code> class is annotated with <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">@Component<\/code> annotation which allows Spring to automatically detect your custom beans.<\/p>\n<p>The other POJO class is <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">Book<\/code> which has a <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">BookPublisher<\/code> associated with it.<\/p>\n<p>This is the code for <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">Book<\/code> class.<\/p>\n<p><strong>Book.java<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\">@Component\r\npublic class Book {\r\n    private String bookTitle;\r\n    private String bookType;\r\n    BookPublisher bookPublisher;\r\n\/\/No-args Constructor\r\n\/\/Parametrized Constructor\r\n\/\/Getters and Setters\r\n\/\/to-String() method\r\n}\r\n<\/pre>\n<p><strong>Note: <\/strong> It is also annotated with <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">@Component<\/code>.<\/p>\n<h2>Configuring the beans for both Spring Containers<\/h2>\n<p>The code for the <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">BeanConfiguration<\/code> class is this.<\/p>\n<p><strong>BeanConfiguration.java<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\">@Configuration\r\npublic class BeanConfiguration {\r\n\r\n    @Bean(name = \"book\")\r\n    public Book getBookDetails() {\r\n        Book book = new Book();\r\n        book.setBookTitle(\"Application Context vs Spring Bean Factory\");\r\n        book.setBookType(\"Reference\");\r\n        book.setBookPublisher(getPublisherDetails());\r\n        return book;\r\n    }\r\n\r\n    @Bean(name = \"bookPublisher\")\r\n    public BookPublisher getPublisherDetails() {\r\n        BookPublisher bookPublisher = new BookPublisher();\r\n        bookPublisher.setPublisherId(101);\r\n        bookPublisher.setFirstName(\"Henry\");\r\n        bookPublisher.setLastName(\"SFG\");\r\n        return bookPublisher;\r\n    }\r\n}\r\n<\/pre>\n<p>This class is annotated with <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">@Configuration<\/code> annotation. It declares Spring beans using the <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">@Bean<\/code> annotations on methods.<\/p>\n<p>The Spring container process these methods to generate bean definitions and service requests for those beans at runtime.<\/p>\n<p>There are two <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">@Bean<\/code> annotated methods namely <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">getBookDetails()<\/code> and <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">getPublisherDetails()<\/code> which return <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">book<\/code> and <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">bookPublisher<\/code> objects respectively.<\/p>\n<h2>Configuring the BeanFactory with XML<\/h2>\n<p>Here, I have configured the <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">BeanFactory<\/code> with XML and created a file <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">beans.xml<\/code> under resources folder.<\/p>\n<p><strong>beans.xml<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\">&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\r\n&lt;beans xsi:schemaLocation=\"http:\/\/www.springframework.org\/schema\/beans http:\/\/www.springframework.org\/schema\/beans\/spring-beans.xsd\"\r\n       xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" xmlns=\"http:\/\/www.springframework.org\/schema\/beans\"&gt;\r\n    &lt;!-- Setter injection--&gt;\r\n    &lt;bean id=\"book\" class=\"org.springframework.guru.domain.Book\"&gt;\r\n        &lt;property name=\"bookPublisher\"&gt;\r\n            &lt;bean class=\"org.springframework.guru.domain.BookPublisher\"&gt;\r\n                &lt;property name=\"publisherId\" value =\"101\"\/&gt;\r\n                &lt;property name=\"firstName\" value=\"Joseph\"\/&gt;\r\n                &lt;property name=\"lastName\" value=\"Ray\"\/&gt;\r\n            &lt;\/bean&gt;\r\n        &lt;\/property&gt;\r\n    &lt;\/bean&gt;\r\n&lt;\/beans&gt;\r\n<\/pre>\n<p>The beans configured are created with the configuration metadata that you supply to the container, here in <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">beans.xml<\/code> file.<\/p>\n<p>Line 5 represents a simple bean definition with <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">id<\/code> and <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">class<\/code> attributes.<\/p>\n<p>The <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">property<\/code> attribute in Line 6 is used to inject the dependencies.<\/p>\n<h2>Running the Application<\/h2>\n<p>This is the code for the Main class.<\/p>\n<p><strong>DemoApplication.java<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\">public class DemoApplication {\r\n\tpublic static void main(String[] args) {\r\n\r\n        \/\/using bean Factory\r\n\tXmlBeanFactory factory=new XmlBeanFactory(new ClassPathResource(\"beans.xml\"));\r\n        System.out.println(factory);\r\n        Book book= (Book) factory.getBean(\"book\");\r\n        System.out.println(book.getBookPublisher());\r\n\r\n         \/\/Using ApplicationContext\r\n         ApplicationContext context=new ClassPathXmlApplicationContext(\"beans.xml\");\r\n          System.out.println(context);\r\n          Book book1= (Book) context.getBean(\"book\");\r\n          System.out.println(book1.getBookPublisher());\r\n\r\n         \/\/Annotation-configuration\r\nAnnotationConfigApplicationContext annotationConfigApplicationContext = new AnnotationConfigApplicationContext();\r\n\tannotationConfigApplicationContext.register(BeanConfiguration.class);\r\n        annotationConfigApplicationContext.refresh();\r\n\tBook book1 = (Book) annotationConfigApplicationContext.getBean(\"book\");\r\n\tSystem.out.println(book1);\r\n\t}\r\n}\r\n<\/pre>\n<p>In Line 5, you create a factory object using the framework <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">APIXmlBeanFactory()<\/code> to create the factory bean. The <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">ClassPathResource()<\/code> API is used to load the bean configuration file available in CLASSPATH.<\/p>\n<p>The <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">XmlBeanFactory()<\/code> API takes care of creating and initializing all the objects, i.e. beans mentioned in the configuration file.<\/p>\n<p>In Line 6, the required bean is obtained using <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">getBean()<\/code> method of the created bean factory object.<\/p>\n<p>This method uses bean Id to return a generic object, which finally can be cast to the actual object.<br \/>\nOnce you have the object, you can use this object to call any class method.<\/p>\n<p>The <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">ApplicationContext<\/code> includes all functionality of the <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">BeanFactory<\/code>, therefore it is generally recommended over <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">BeanFactory<\/code>.<\/p>\n<p>Line 10 uses the framework <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">ClassPathXmlApplicationContext<\/code> to create factory object to load the bean configuration file from the given path.<\/p>\n<p><a href=\"http:\/\/springframework.guru\/wp-content\/uploads\/2021\/04\/Output_core.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-7135\" src=\"http:\/\/springframework.guru\/wp-content\/uploads\/2021\/04\/Output_core-1024x188.png\" alt=\"beanfactory vs applicationcontext\" width=\"1024\" height=\"188\" srcset=\"https:\/\/springframework.guru\/wp-content\/uploads\/2021\/04\/Output_core-1024x188.png 1024w, https:\/\/springframework.guru\/wp-content\/uploads\/2021\/04\/Output_core-300x55.png 300w, https:\/\/springframework.guru\/wp-content\/uploads\/2021\/04\/Output_core-768x141.png 768w, https:\/\/springframework.guru\/wp-content\/uploads\/2021\/04\/Output_core-848x156.png 848w, https:\/\/springframework.guru\/wp-content\/uploads\/2021\/04\/Output_core-410x75.png 410w, https:\/\/springframework.guru\/wp-content\/uploads\/2021\/04\/Output_core.png 1105w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/p>\n<p>In the above console output figure, you can clearly make out the difference between the two of them.<\/p>\n<p>The <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">BeanFactory<\/code> instantiates a bean when you call the <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">getBean()<\/code> method.<br \/>\nWhereas the <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">ApplicationContext<\/code> instantiates a Singleton bean as soon as the container is started.<\/p>\n<p>Also, the <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">BeanFactory<\/code> implementations cannot be used with annotation configuration. I have therefore, used <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">AnnotationConfigApplicationContext<\/code> one of the implementation of <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">ApplicationContext<\/code> to call the <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">getBean()<\/code> method.<\/p>\n<p>The proceeding figure shows the console output.<\/p>\n<p><a href=\"http:\/\/springframework.guru\/wp-content\/uploads\/2021\/04\/output_core2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-7136\" src=\"http:\/\/springframework.guru\/wp-content\/uploads\/2021\/04\/output_core2-1024x191.png\" alt=\"annotation based configuration\" width=\"1024\" height=\"191\" srcset=\"https:\/\/springframework.guru\/wp-content\/uploads\/2021\/04\/output_core2-1024x191.png 1024w, https:\/\/springframework.guru\/wp-content\/uploads\/2021\/04\/output_core2-300x56.png 300w, https:\/\/springframework.guru\/wp-content\/uploads\/2021\/04\/output_core2-768x143.png 768w, https:\/\/springframework.guru\/wp-content\/uploads\/2021\/04\/output_core2-848x158.png 848w, https:\/\/springframework.guru\/wp-content\/uploads\/2021\/04\/output_core2-410x76.png 410w, https:\/\/springframework.guru\/wp-content\/uploads\/2021\/04\/output_core2.png 1322w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/p>\n<h2>Summary<\/h2>\n<p>The <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">BeanFactory<\/code> is usually preferred where the resources are limited like mobile devices or applet-based applications. Thus, use an <code class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"git\" data-enlighter-linenumbers=\"false\">ApplicationContext<\/code> unless you have a good reason for not doing so.<\/p>\n<p>You can find the source code of this post on <a href=\"https:\/\/github.com\/spring-framework-guru\/sfg-blog-posts\/tree\/master\/spring-core-concepts\" target=\"_blank\" rel=\"noopener\">Github<\/a>.<\/p>\n<p>For in-depth knowledge on Spring Framework concepts, you can check my Udemy Best Seller Course on <a href=\"https:\/\/www.udemy.com\/course\/spring-framework-5-beginner-to-guru\/?referralCode=6D9ECD1F93988FEE5CE9\" target=\"_blank\" rel=\"noopener\">Spring Framework 5: Beginner to Guru<\/a><\/p>\n<p><a href=\"https:\/\/www.udemy.com\/course\/spring-framework-5-beginner-to-guru\/?referralCode=6D9ECD1F93988FEE5CE9\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-4656 size-full\" src=\"http:\/\/springframework.guru\/wp-content\/uploads\/2017\/07\/Spring-5ver02bweb.jpg\" alt=\"Udemy Course on Spring Framework\" width=\"560\" height=\"315\" srcset=\"https:\/\/springframework.guru\/wp-content\/uploads\/2017\/07\/Spring-5ver02bweb.jpg 560w, https:\/\/springframework.guru\/wp-content\/uploads\/2017\/07\/Spring-5ver02bweb-300x169.jpg 300w, https:\/\/springframework.guru\/wp-content\/uploads\/2017\/07\/Spring-5ver02bweb-410x231.jpg 410w\" sizes=\"(max-width: 560px) 100vw, 560px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Spring Ioc container is at the core of the Spring Framework. BeanFactory and ApplicationContext provide implementations of the IoC container. Both BeanFactory and ApplicationContext are interfaces and there are several implementations that come out of the box with Spring. In this post, I will explain the differences between BeanFactory and ApplicationContext. Major Differences between [&hellip;]<a href=\"https:\/\/springframework.guru\/spring-beanfactory-vs-applicationcontext\/\" class=\"df-link-excerpt\">Continue reading<\/a><\/p>\n","protected":false},"author":111,"featured_media":579,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"","_lmt_disable":"","_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[21,6],"tags":[40,49,155,355],"class_list":["post-7125","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-spring","category-spring-core","tag-spring","tag-spring-bean","tag-spring-configuration","tag-spring-ioc-containers"],"jetpack_publicize_connections":[],"aioseo_notices":[],"modified_by":"jt","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/springframework.guru\/wp-content\/uploads\/2015\/03\/Banner560x292_02.png","jetpack_shortlink":"https:\/\/wp.me\/p5BZrZ-1QV","_links":{"self":[{"href":"https:\/\/springframework.guru\/wp-json\/wp\/v2\/posts\/7125"}],"collection":[{"href":"https:\/\/springframework.guru\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/springframework.guru\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/springframework.guru\/wp-json\/wp\/v2\/users\/111"}],"replies":[{"embeddable":true,"href":"https:\/\/springframework.guru\/wp-json\/wp\/v2\/comments?post=7125"}],"version-history":[{"count":38,"href":"https:\/\/springframework.guru\/wp-json\/wp\/v2\/posts\/7125\/revisions"}],"predecessor-version":[{"id":7366,"href":"https:\/\/springframework.guru\/wp-json\/wp\/v2\/posts\/7125\/revisions\/7366"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/springframework.guru\/wp-json\/wp\/v2\/media\/579"}],"wp:attachment":[{"href":"https:\/\/springframework.guru\/wp-json\/wp\/v2\/media?parent=7125"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/springframework.guru\/wp-json\/wp\/v2\/categories?post=7125"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/springframework.guru\/wp-json\/wp\/v2\/tags?post=7125"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}