Recall & Review
beginner Click to reveal answer
What is a Bean in Spring Framework?
A Bean is an object that is managed by the Spring container. It is created, configured, and assembled by Spring to be used in the application.
beginner Click to reveal answer
How does Spring know which classes to manage as Beans?
Spring uses annotations like @Component, @Service, @Repository, or XML configuration to identify and manage classes as Beans.
intermediate Click to reveal answer
What is the default scope of a Bean in Spring?
The default scope is 'singleton', meaning Spring creates only one instance of the Bean per container.
intermediate Click to reveal answer
Explain the difference between singleton and prototype Bean scopes.
Singleton scope creates one shared instance for the whole application. Prototype scope creates a new instance every time the Bean is requested.
beginner Click to reveal answer
What is Dependency Injection in the context of Spring Beans?
Dependency Injection is when Spring automatically provides the required Beans to other Beans, so they don’t have to create or find them manually.
Which annotation is commonly used to mark a class as a Spring Bean?
✗ Incorrect
@Component is used to mark a class as a Spring-managed Bean.
What is the default scope of a Spring Bean?
✗ Incorrect
By default, Spring Beans are singleton scoped.
Which of the following is NOT a valid Spring Bean scope?
✗ Incorrect
'transient' is not a Spring Bean scope.
What does Dependency Injection help with in Spring?
✗ Incorrect
Dependency Injection automatically provides Beans where needed.
Which annotation is used to inject a Bean into another Bean?
✗ Incorrect
@Autowired is used to inject Beans into other Beans.
Describe what a Spring Bean is and how Spring manages it.
Think about how Spring controls the objects your app uses.
You got /3 concepts.
Explain the difference between singleton and prototype Bean scopes in Spring.
Consider how many copies of the Bean exist in each scope.
You got /3 concepts.
