How do you define the scope of a bean?



How do you define the scope of a bean?..

Answer / 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

More Spring Framework Interview Questions

What is the meaning of ioc in spring?

1 Answers  


How does dependency injection work in spring?

1 Answers  


What are some of the design patterns used in the spring framework?

1 Answers  


What are advice, aspect, join-point and point cut in spring?

1 Answers  


Is entitymanager thread safe?

1 Answers  


What is the web module?

1 Answers  


Why do we use aop in spring?

1 Answers  


How does the ioc work?

1 Answers  


What is an advice? What are the different types of advices?

1 Answers  


Is spring data jpa an orm?

1 Answers  


How to inject a java.util.properties into a spring bean?

1 Answers  


Explain the term proxy?

1 Answers  


Categories