seniorSpring

What is the difference between Spring Bean scopes (singleton, prototype, request, session)?

Updated May 17, 2026

Short answer

Bean scope defines lifecycle and visibility of Spring beans like singleton, prototype, request, and session.

Deep explanation

Singleton creates one instance per container. Prototype creates a new instance every time. Request and session scopes are web-aware and tied to HTTP lifecycle. Scope choice impacts memory, thread safety, and performance.

Unlock with a Pro subscription to view this section.

View pricing

Real-world example

No real-world example available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Common mistakes

No common mistakes listed yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Follow-up questions

No follow-up questions available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

More Spring interview questions

View all →