Bird
0
0

Which @Scope value should be used to create a new bean instance for every HTTP request in a Spring Boot web application?

easy📝 Conceptual Q2 of 15
Spring Boot - Spring Annotations
Which @Scope value should be used to create a new bean instance for every HTTP request in a Spring Boot web application?
Asingleton
Brequest
Cprototype
Dsession
Step-by-Step Solution
Solution:
  1. Step 1: Identify scope for per HTTP request instance

    The 'request' scope creates a new bean instance for each HTTP request.
  2. Step 2: Match scope to HTTP request lifecycle

    Request scope ties bean lifecycle to the HTTP request lifecycle.
  3. Final Answer:

    request -> Option B
  4. Quick Check:

    HTTP request scope = request [OK]
Quick Trick: Use 'request' scope for one bean per HTTP request [OK]
Common Mistakes:
  • Using prototype for HTTP request
  • Confusing session with request
  • Using singleton for per request instance

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes