Bean Scope

Learn about the differences between singleton and prototype bean scopes and how to implement them.

The Spring container manages beans. The term bean scope refers to the lifecycle and the visibility of beans. It tells how long the bean lives, how many instances of the bean are created, and how the bean is shared.

Types of bean scopes

There are six types of scopes: singleton, prototype, request, session, application, and websocket.

Press + to interact
Types of bean scopes
Types of bean scopes

The singleton and prototype scopes can be used in any application while the last four scopes are only available for a web application. In this lesson, we will focus on singleton and prototype bean scopes only.

Singleton scope

The default scope of a bean is ...

Access this course and 1400+ top-rated courses and projects.