Explain the difference between Singleton and prototype bean in spring?
Singleton | Prototype | |
---|---|---|
1. | Single bean to a single object | Single bean to any number of objects |
2. | Returns same object each time it gets injected | Creates a new object each time it gets injected |
3. | Use for stateless beans | Use for stateful beans |
BY Best Interview Question ON 18 Jan 2019