DIGITAL GURU
Java Roadmap Portfolio

Spring Bean Scopes (Singleton vs Prototype)

Understand Singleton, Prototype, Request, and Session bean scopes with beginner examples.

Anuj Kumar Singh Written by Anuj Kumar Singh (Lead Engineer, 13+ yrs exp) 5 min read Verified Spring Boot 3+ Guide
3D Architecture Visualizer

Spring Bean Scopes Explained

A Scope defines how long a bean lives and how many instances Spring creates.

Scope How Many Instances? Best Used For
Singleton (Default) Exactly 1 shared instance per application Services, Repositories, Controllers (Stateless classes)
Prototype A NEW instance every time requested Stateful objects holding unique data per request
Request (Web) 1 instance per HTTP Request User Request tracking context
Session (Web) 1 instance per User HTTP Session User Shopping Cart, Login Session