How do you define a bean scope?

Technology CommunityCategory: SpringHow do you define a bean scope?
VietMX Staff asked 3 years ago

When defining a 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.