Spring / Spring7 basics Interview questions
What are the types of bean scopes in Spring?
Bean scope defines how many instances of a bean the container creates and how long each one lives.
| Scope | Lifetime |
| singleton | One shared instance per container (the default) |
| prototype | A new instance every time the bean is requested |
| request | One instance per HTTP request (web-aware contexts) |
| session | One instance per HTTP session |
| application | One instance per ServletContext |
singleton and prototype are always available; request, session, and application only apply in a web-aware ApplicationContext. Scope is set with @Scope("prototype") or the equivalent XML attribute.
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
