

{"id":20311,"date":"2018-07-06T04:00:22","date_gmt":"2018-07-06T04:00:22","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=20311"},"modified":"2018-09-15T12:27:21","modified_gmt":"2018-09-15T06:57:21","slug":"spring-bean-scope","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/spring-bean-scope\/","title":{"rendered":"Spring Bean Scope | 5 Major Types of Scope in Spring"},"content":{"rendered":"<div class='__iawmlf-post-loop-links' style='display:none;' data-iawmlf-post-links='[{&quot;id&quot;:1900,&quot;href&quot;:&quot;https:\\\/\\\/docs.spring.io\\\/spring\\\/docs\\\/3.0.0.M3\\\/reference\\\/html\\\/ch04s04.html&quot;,&quot;archived_href&quot;:&quot;http:\\\/\\\/web-wp.archive.org\\\/web\\\/20200919032409\\\/https:\\\/\\\/docs.spring.io\\\/spring\\\/docs\\\/3.0.0.M3\\\/reference\\\/html\\\/ch04s04.html&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2025-12-10 07:30:43&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2025-12-19 14:57:55&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-01-04 13:01:46&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-01-20 13:09:23&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-02-04 02:59:04&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-03-14 15:09:15&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-03-28 18:23:45&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-04-01 07:30:49&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-04-04 15:00:41&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-04-08 04:36:29&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-04-14 07:26:47&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-04-28 05:28:31&quot;,&quot;http_code&quot;:404}],&quot;broken&quot;:true,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-28 05:28:31&quot;,&quot;http_code&quot;:404},&quot;process&quot;:&quot;done&quot;}]'><\/div>\n<h2>1. Objective<\/h2>\n<p>In the previous article, we learned about the <a href=\"https:\/\/data-flair.training\/blogs\/spring-bean\/\"><strong>Spring Bean definition<\/strong><\/a>.\u00a0Today, we will get to know about the Spring Bean Scope. Moreover, we will discuss different types of Scopes in Spring Beans. Each of the scopes will be defined with working examples using Eclipse IDE. In addition, we will get to know when to use a singleton and prototype scope in <a href=\"https:\/\/data-flair.training\/blogs\/spring-framework-tutorial\/\"><strong>Spring Framework<\/strong><\/a>.<br \/>\nSo, let&#8217;s start Spring Bean Scope.<\/p>\n<div id=\"attachment_20335\" style=\"width: 1210px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/Spring-Bean-Scopes-01.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-20335\" class=\"wp-image-20335 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/Spring-Bean-Scopes-01.jpg\" alt=\"Spring Bean Scope | 5 Major Types of Scope in Spring\" width=\"1200\" height=\"628\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/Spring-Bean-Scopes-01.jpg 1200w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/Spring-Bean-Scopes-01-150x79.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/Spring-Bean-Scopes-01-300x157.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/Spring-Bean-Scopes-01-768x402.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/Spring-Bean-Scopes-01-1024x536.jpg 1024w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/a><p id=\"caption-attachment-20335\" class=\"wp-caption-text\">Spring Bean Scope | 5 Major Types of Scope in Spring<\/p><\/div>\n<h2>2. Spring Bean Scope<\/h2>\n<p>As you know the scope of the Spring bean defines the<a href=\"https:\/\/data-flair.training\/blogs\/spring-bean-life-cycle\/\"> <strong>life cycle<\/strong><\/a> and the visibility of the bean in contexts in which it is used. While defining a &lt;bean&gt; you have the chance of declaring the scope of that particular Spring bean.<br \/>\n<strong><a href=\"https:\/\/data-flair.training\/blogs\/advantages-of-spring\/\">Let&#8217;s explore Advantages of Spring Framework With Limitations<\/a><\/strong><\/p>\n<h2>3. Types of Scope in Spring Bean<\/h2>\n<p>The Spring Framework has five types of scope that it supports. These are as follow:<\/p>\n<h3>a. Singleton Scope\u00a0in Spring<\/h3>\n<p>If the Spring Bean scope is made singleton then the <a href=\"https:\/\/data-flair.training\/blogs\/spring-ioc-containers\/\"><strong>Spring IoC container<\/strong> <\/a>defines only one instance of the object. That instance gets stored in the cache of singleton beans. Also, all the requests for that name will return the same instance which is cached. Along with that, any modifications made to that instance will get reflected in all references to a Spring bean.<br \/>\n<strong>Let\u2019s create an entity Person as follow:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">public class Person {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 private String name;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/ standard constructor, getters and setters\r\n}<\/pre>\n<p><strong>Spring Beans with singleton scope:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">@Bean\r\n@Scope(\"singleton\")\r\npublic Person personSingleton() {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 return new Person();\r\n}<\/pre>\n<p><strong><a href=\"https:\/\/data-flair.training\/blogs\/spring-framework-career\/\">Do you know the latest Job Roles and Salary trend of Spring Framework<\/a><\/strong><br \/>\nYou can also see two objects referring to same beans with same values:<\/p>\n<pre class=\"EnlighterJSRAW\">private static final String NAME = \"Sam\";\r\n@Test\r\npublic void givenSingletonScope_whenSetName_thenEqualNames() {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 ApplicationContext applicationContext = new ClassPathXmlApplicationContext(\"scopes.xml\");\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 Person personSingletonA = (Person) applicationContext.getBean(\"personSingleton\");\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 Person personSingletonB = (Person) applicationContext.getBean(\"personSingleton\");\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 personSingletonA.setName(NAME);\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 Assert.assertEquals(NAME, personSingletonB.getName());\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 ((AbstractApplicationContext) applicationContext).close();\r\n}<\/pre>\n<p><strong>The scopes.xml is as follows:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\r\n&lt;beans xmlns=\"http:\/\/www.springframework.org\/schema\/beans\"\r\nxmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"\r\nxsi:schemaLocation=\"http:\/\/www.springframework.org\/schema\/beans\r\nhttp:\/\/www.springframework.org\/schema\/beans\/spring-beans.xsd\"&gt;\r\n&lt;bean id=\"personSingleton\" class=\"org.example.scopes.Person\" scope=\"singleton\"\/&gt;\r\n&lt;\/beans&gt;<\/pre>\n<h3>b. Prototype Scope\u00a0in Spring<\/h3>\n<p>This will scope a bean definition to have any number of objects instances. It will return different instance every time request comes from IoC container.<br \/>\n<strong><a href=\"https:\/\/data-flair.training\/blogs\/spring-java-based-configuration\/\">Read about Spring Java Based Configuration &#8211; How to Configure Spring Beans<\/a><\/strong><br \/>\nThe prototype is set to the @Scope annotation in bean definition:<\/p>\n<pre class=\"EnlighterJSRAW\">@Bean\r\n@Scope(\"prototype\")\r\npublic Person personPrototype() {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 return new Person();\r\n}<\/pre>\n<p>You will see the same test which is done for the Spring Singleton scope which is two objects requesting same bean name:<\/p>\n<pre class=\"EnlighterJSRAW\">private static final String NAME = \"Sam\";\r\nprivate static final String NAME_OTHER = \"Hari\";\r\n@Test\r\npublic void givenPrototypeScope_whenSetNames_thenDifferentNames() {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 ApplicationContext applicationContext = new ClassPathXmlApplicationContext(\"scopes.xml\");\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 Person personPrototypeA = (Person) applicationContext.getBean(\"personPrototype\");\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 Person personPrototypeB = (Person) applicationContext.getBean(\"personPrototype\");\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 personPrototypeA.setName(NAME);\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 personPrototypeB.setName(NAME_OTHER);\u00a0\u00a0\u00a0\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 Assert.assertEquals(NAME, personPrototypeA.getName());\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 Assert.assertEquals(NAME_OTHER, personPrototypeB.getName());\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 ((AbstractApplicationContext) applicationContext).close();\r\n}<\/pre>\n<p><strong>The scopes.xml is defined as:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">&lt;bean id=\"personPrototype\" class=\"org.example.scopes.Person\" scope=\"prototype\"\/&gt;<\/pre>\n<h3>c. Request Scope\u00a0in Spring<\/h3>\n<p>This request will scope a bean definition to HTPP request. This is only there in context of web-aware Spring Application context. You will define the bean with the request scope under the @Scope annotation:<\/p>\n<pre class=\"EnlighterJSRAW\">@Bean\r\n@Scope(value = WebApplicationContext.SCOPE_REQUEST, proxyMode = ScopedProxyMode.TARGET_CLASS)\r\npublic HelloMessageGenerator requestMessage() {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 return new HelloMessageGenerator();\r\n}<\/pre>\n<p>The attribute proxyMode is needed as during the instantiation of web application context, there is no active request. The Spring Framework will create the proxy for the injection as a dependency.<br \/>\nNext, you should define the controller that has a reference to the requestMessage bean. For that, you need to access the same request more than once to test the web-specific scopes.<\/p>\n<pre class=\"EnlighterJSRAW\">@Controller\r\npublic class ScopesController {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 @Resource(name = \"requestMessage\")\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 HelloMessageGenerator requestMessage;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 @RequestMapping(\"\/scopes\")\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 public String getScopes(Model model) {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0requestMessage.setMessage(\"Good morning!\");\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0model.addAttribute(\"requestMessage\", requestMessage.getMessage());\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0return \"scopesExample\";\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 }\r\n}<\/pre>\n<h3>d. Session Scope\u00a0in Spring<\/h3>\n<p>In the same way, you can define the beans within the session scope as:<\/p>\n<pre class=\"EnlighterJSRAW\">@Bean\r\n@Scope(value = WebApplicationContext.SCOPE_SESSION, proxyMode = ScopedProxyMode.TARGET_CLASS)\r\npublic HelloMessageGenerator sessionMessage() {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 return new HelloMessageGenerator();\r\n}<\/pre>\n<p>In the same fashion, the controller with the reference to the\u00a0sessionMessage bean is defined. For that, you need to run two requests so as to show the value of message field is same for the session.<br \/>\n<strong><a href=\"https:\/\/data-flair.training\/blogs\/spring-transaction-management\/\">Have a look Spring Transaction Management &#8211; Types and Methods<\/a><\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">@Controller\r\npublic class ScopesController {\r\n\u00a0\u00a0\u00a0\u00a0 @Resource(name = \"sessionMessage\")\r\n\u00a0\u00a0\u00a0\u00a0 HelloMessageGenerator sessionMessage;\r\n\u00a0\u00a0\u00a0\u00a0 @RequestMapping(\"\/scopes\")\r\n\u00a0\u00a0\u00a0\u00a0 public String getScopes(Model model) {\r\n\u00a0\u00a0\u00a0\u00a0 sessionMessage.setMessage(\"Hello there!\");\r\n\u00a0\u00a0\u00a0\u00a0 model.addAttribute(\"sessionMessage\", sessionMessage.getMessage());\r\n\u00a0\u00a0\u00a0\u00a0 return \"scopesExample\";\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 }\r\n}<\/pre>\n<h3>e. Global Session Scope in Spring<\/h3>\n<p>This scopes the bean definition to global HTTP session and is only valid for web-aware Application context of Spring. This type is used in portlet container applications where each portlet having their session. Now you will see the bean with globalSession scope under the @Scope annotation:<\/p>\n<pre class=\"EnlighterJSRAW\">@Bean\r\n@Scope(value = WebApplicationContext.SCOPE_GLOBAL_SESSION, proxyMode = ScopedProxyMode.TARGET_CLASS)\r\npublic HelloMessageGenerator globalSessionMessage() {\r\nreturn new HelloMessageGenerator();\r\n}<\/pre>\n<p>So, this was all about Spring Bean Scope Tutorial. Hope you like our explanation.<\/p>\n<h2>4. Conclusion<\/h2>\n<p>Hence, in this session, we have seen what is Spring Bean Scope and how to define the scopes of beans. In addition, we discussed different types of scopes in Spring Bean. Also, we saw each of the types of scopes defined separately with the examples using Eclipse IDE. Furthermore, if you have any query regarding Spring Bean Scope, feel free to ask in the comment section.<br \/>\nRelated Topic-\u00a0<strong><a href=\"https:\/\/data-flair.training\/blogs\/spring-mvc-framework\/\">Integration of MVC with Spring<\/a><\/strong><br \/>\n<strong><a href=\"https:\/\/docs.spring.io\/spring\/docs\/3.0.0.M3\/reference\/html\/ch04s04.html\">For reference<\/a><\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. Objective In the previous article, we learned about the Spring Bean definition.\u00a0Today, we will get to know about the Spring Bean Scope. Moreover, we will discuss different types of Scopes in Spring Beans.&#46;&#46;&#46;<\/p>\n","protected":false},"author":5,"featured_media":20335,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[64],"tags":[1690,5110,10228,11562,12762,12925,13251,13271,13354,13369,15109],"class_list":["post-20311","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-spring","tag-bean-scope-in-spring","tag-global-session-scope-in-spring","tag-prototype-scope-in-spring","tag-request-scope-in-spring","tag-session-scope-in-spring","tag-singleton-scope-in-spring","tag-spring-bean-life-cycle","tag-spring-boot-bean-scope","tag-spring-request-scope-example","tag-spring-singleton-annotation","tag-types-of-scopes-in-spring-beans"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Spring Bean Scope | 5 Major Types of Scope in Spring - DataFlair<\/title>\n<meta name=\"description\" content=\"Spring Bean Scope tutorial, what is the scope of Spring Beans, tyes of Spring Bean Scopes,Global session,Prototype, Spring Request, Session, Singleton Scope\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/spring-bean-scope\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Spring Bean Scope | 5 Major Types of Scope in Spring - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Spring Bean Scope tutorial, what is the scope of Spring Beans, tyes of Spring Bean Scopes,Global session,Prototype, Spring Request, Session, Singleton Scope\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/spring-bean-scope\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-07-06T04:00:22+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-09-15T06:57:21+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/Spring-Bean-Scopes-01.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Spring Bean Scope | 5 Major Types of Scope in Spring - DataFlair","description":"Spring Bean Scope tutorial, what is the scope of Spring Beans, tyes of Spring Bean Scopes,Global session,Prototype, Spring Request, Session, Singleton Scope","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/spring-bean-scope\/","og_locale":"en_US","og_type":"article","og_title":"Spring Bean Scope | 5 Major Types of Scope in Spring - DataFlair","og_description":"Spring Bean Scope tutorial, what is the scope of Spring Beans, tyes of Spring Bean Scopes,Global session,Prototype, Spring Request, Session, Singleton Scope","og_url":"https:\/\/data-flair.training\/blogs\/spring-bean-scope\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2018-07-06T04:00:22+00:00","article_modified_time":"2018-09-15T06:57:21+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/Spring-Bean-Scopes-01.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/spring-bean-scope\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/spring-bean-scope\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823"},"headline":"Spring Bean Scope | 5 Major Types of Scope in Spring","datePublished":"2018-07-06T04:00:22+00:00","dateModified":"2018-09-15T06:57:21+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/spring-bean-scope\/"},"wordCount":679,"commentCount":0,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/spring-bean-scope\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/Spring-Bean-Scopes-01.jpg","keywords":["bean scope in spring","Global-session Scope in Spring","Prototype Scope in Spring","Request Scope in Spring","Session Scope in Spring","Singleton Scope in Spring","spring bean life cycle","spring boot bean scope","spring request scope example","spring singleton annotation","types of Scopes in Spring Beans"],"articleSection":["Spring Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/spring-bean-scope\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/spring-bean-scope\/","url":"https:\/\/data-flair.training\/blogs\/spring-bean-scope\/","name":"Spring Bean Scope | 5 Major Types of Scope in Spring - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/spring-bean-scope\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/spring-bean-scope\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/Spring-Bean-Scopes-01.jpg","datePublished":"2018-07-06T04:00:22+00:00","dateModified":"2018-09-15T06:57:21+00:00","description":"Spring Bean Scope tutorial, what is the scope of Spring Beans, tyes of Spring Bean Scopes,Global session,Prototype, Spring Request, Session, Singleton Scope","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/spring-bean-scope\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/spring-bean-scope\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/spring-bean-scope\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/Spring-Bean-Scopes-01.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/Spring-Bean-Scopes-01.jpg","width":1200,"height":628,"caption":"Spring Bean Scope | 5 Major Types of Scope in Spring"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/spring-bean-scope\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Reading data from external files","item":"https:\/\/data-flair.training\/blogs\/tag\/reading-data-from-external-files\/"},{"@type":"ListItem","position":3,"name":"Spring Bean Scope | 5 Major Types of Scope in Spring"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team creates expert-level guides on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our goal is to empower learners with easy-to-understand content. Explore our resources for career growth and practical learning.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam1\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/20311","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=20311"}],"version-history":[{"count":3,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/20311\/revisions"}],"predecessor-version":[{"id":32627,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/20311\/revisions\/32627"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/20335"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=20311"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=20311"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=20311"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}