Grokking Java Interview Questions
0% completed
Bean Scopes and Lifecycle
A grocery store application contains objects that should live for different lengths of time:
- The
Stockobject should exist once, and every part of the application should use it. - A
Cartshould be new each time a checkout begins. - The details of the current customer should exist for one HTTP request and then disappear.
Spring creates all three, and one setting on each bean selects the rule. This setting is the scope of the bean
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%