Mid-levelMid (3–6 yrs)JavaSpring BootAmazonJP MorganInfosys
Spring bean scopes
Explain Singleton vs Prototype vs Request scopes in Spring.
Answers use simple, clear English.
Audio N/AQuick interview answer
Singleton (default) is one bean per container. Prototype creates a new instance per injection. Request/Session are web-aware scopes.
Detailed answer
Singleton (default) is one bean per container. Prototype creates a new instance per injection. Request/Session are web-aware scopes. Injecting a Prototype into a Singleton still happens once unless you use Provider/ObjectFactory or @Lookup. Request-scoped beans need proxies when injected into singletons.
midsenior#spring#di