Exam 2v0-7222 All QuestionsBrowse all questions from this exam
Question 12

Spring puts each bean instance in a scope. What is the default scope? (Choose the best answer.)

    Correct Answer: B

    In Spring, the default scope for a bean is 'singleton'. This means that the Spring container creates exactly one instance of the bean, and all requests for that bean will return the same instance. The prototype scope creates a new bean instance on each request, and the request and session scopes are typically used in web applications, binding the bean's lifecycle to an HTTP request or session, respectively.

Discussion
james2033Option: B

The singleton scope is the default scope in Spring. https://docs.spring.io/spring-framework/docs/3.0.0.M3/reference/html/ch04s04.html#:~:text=The%20singleton%20scope%20is%20the%20default%20scope%20in%20Spring.

james2033Option: B

Quote “The singleton scope is the default scope in Spring.” at https://docs.spring.io/spring-framework/docs/3.0.0.M3/reference/html/ch04s04.html at Section 4.4.1 , paragraph 3.

saturnringsOption: B

Obviously B, Singleton