What is spring Bean scopes ?
it is just an interview question which i have faced!!! A simple one.... Any way i couldn't answer it .
For the sake of next interview i am going to answer it in here:
When defining a <bean> in Spring, you have the option of declaring a scope for that bean. For example, To force Spring to produce a new bean instance each time one is needed, you should declare the bean's scope attribute to be prototype. Similar way if you want Spring to return the same bean instance each time one is needed, you should declare the bean's scope attribute to be singleton.
The Spring Framework supports following five scopes, three of which are available only if you use a web-aware ApplicationContext.
Scope | Description |
---|---|
singleton | This scopes the bean definition to a single instance per Spring IoC container (default). |
prototype | This scopes a single bean definition to have any number of object instances. |
request | This scopes a bean definition to an HTTP request. Only valid in the context of a web-aware Spring ApplicationContext. |
session | This scopes a bean definition to an HTTP session. Only valid in the context of a web-aware Spring ApplicationContext. |
global-session | This scopes a bean definition to a global HTTP session. Only valid in the context of a web-aware Spring ApplicationContext. |
ReplyDeleteReally Good blog post.provided a helpful information about bean scopes .keep updating...
Digital marketing company in Chennai
Interesting blog about spring bean scopes which attracted me more.Spend a worthful time.keep updating more.
ReplyDeleteMSBI Training in Chennai
Interesting blog post.This blog shows that you have a great future as a content writer.waiting for more updates...
ReplyDeleteVmware Training in Chennai
Web Designing Training in Chennai
AWS Training in Chennai
Linux Training in Chennai
Microsoft Azure Training in Chennai
This information is impressive; I am inspired with your post writing style & how continuously you describe this topic.
ReplyDeleteEczema Treatment
I must thank you for the efforts you have put in spending this site. I am hoping to out the same high-grade content by you later on as well. In truth, your creative writing abilities has inspired me to get my own, personal blog now..
ReplyDeleteJava Training in Chennai
Dot Net Training in Chennai
Cloud Computing Training in Chennai
Digital Marketing Training in Chennai
SAS Training in Chennai
SEO Training in Chennai
AWS Training in Chennai
Microsoft Azure Training in Chennai