Grokking Spring Boot
Vote

0% completed

​

Bean Scopes

A team adds a field to BookingService that remembers the email of the current customer. One method stores the email, and a second method reads it to build the booking. Every test passes, because each test sends one request at a time.

On the first busy evening, Ana books seat A12 and receives a confirmation that names Ben. Every request shares the same BookingService object, so Ben's request overwrote the field between Ana's two steps.

How many objects the container makes from one bean definition, and who shares them, is called the scope of the bean

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content