Sobes.tech
Junior — Middle

What default scope rule is applied to Beans in the Spring Framework?

sobes.tech AI

Answer from AI

In Spring Framework, the default scope for a Bean is singleton. This means that only one instance of the bean is created within the Spring container, and all requests for that bean return the same object.

Example:

@Component
public class MyService {
    // This bean will be a singleton by default
}

If you want to change the scope, you can use the @Scope annotation.

What default scope rule is applied to Beans in the… - sobes.tech