You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Basics of SpringBoot/Singleton vs Prototype.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,9 +4,9 @@
4
4
* A prototype scope means that a new instance of the bean is created each time it is requested. Each consumer gets a unique instance.
5
5
## Characteristics:
6
6
7
-
##Multiple Instances: A new instance is created every time the bean is requested from the application context.
8
-
##Memory Usage: Can consume more memory and resources since multiple instances may be created, especially if the bean is requested frequently.
9
-
##No Shared State: Each instance is independent, so changes to one instance do not affect others. This is useful for beans that need to maintain state that is unique per request or user.
7
+
* Multiple Instances: A new instance is created every time the bean is requested from the application context.
8
+
* Memory Usage: Can consume more memory and resources since multiple instances may be created, especially if the bean is requested frequently.
9
+
* No Shared State: Each instance is independent, so changes to one instance do not affect others. This is useful for beans that need to maintain state that is unique per request or user.
10
10
## Use Cases:
11
11
* Stateful Beans: Ideal for beans that need to maintain unique state for each consumer or interaction.
12
12
* Transient Beans: Useful when beans are short-lived and their state should not be shared.
0 commit comments