Bird
0
0

Which statement best describes how Spring Boot manages classes annotated with @Component internally?

hard📝 Conceptual Q10 of 15
Spring Boot - Inversion of Control and Dependency Injection
Which statement best describes how Spring Boot manages classes annotated with @Component internally?
ASpring creates a new instance every time the component is requested
BSpring creates and manages singleton instances by default in its application context
CSpring requires manual instantiation of @Component classes
DSpring only manages @Component classes if they implement an interface
Step-by-Step Solution
Solution:
  1. Step 1: Recall Spring bean scope default

    By default, Spring creates one singleton instance per @Component class in the application context.
  2. Step 2: Eliminate incorrect behaviors

    Spring does not create new instances on each request unless scope is changed; manual instantiation is not needed; interfaces are not required.
  3. Final Answer:

    Spring creates and manages singleton instances by default in its application context -> Option B
  4. Quick Check:

    @Component beans = Singleton by default [OK]
Quick Trick: Default scope for @Component beans is singleton [OK]
Common Mistakes:
  • Assuming prototype scope by default
  • Thinking manual creation is needed
  • Believing interfaces are mandatory

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes