adspace


How do you define the scope of a bean?

Answer Posted / Vikash

The scope of a Spring bean can be defined using the scope attribute in the bean definition. The available scopes are singleton, prototype, request, session, application, and webSocket. Singleton creates a single instance that is shared among all beans, while prototype creates a new instance every time it's requested.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can you inject java collection in spring?

518


What is difference between @controller and @restcontroller in spring?

556


What is lazy class?

490